I've added this lines:
RewriteCond %{HTTP_HOST} ^www\. RewriteCond %{HTTPS} off RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www\.)?(.+)$ RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Now redirect always query to non-www but still i got domain.com/index.php...
I've cleared browser and open in private window but nothing changed
I've added your lines after RewriteBase / and index.php is gone
But when i've added your first two lines and added RewriteBase / with few lines after that page doesn't work even without www. I don't know why
In firefox works, in private mode chrome works but... I clear cache open new window and doesn't work for chrome in normal mode... wtf.
then looks like browser cache issue.
Please clear chrome browser cache and cookie once and check.
I've cleaned cached and i can enter to page with www but i've got another problem. Now i can only get access to main site i.e domain.com but to other sites even admin panel i can't get access.
try to update last line:
RewriteCond %{HTTP_HOST} ^www\. RewriteCond %{HTTPS} off RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www\.)?(.+)$ RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/$1 [L,R=301]
I have added /$1
Now, instead error 404 i've got error 411. but when i comment this line everything works fine but i need redirect from http to https. Any clue how can i do this thing?
for https:
you can add https url in unsecure and secure url and change setting
use for frontend = "Yes"
use for admin = "Yes"
now I will not suggest more experiment with .htaccess
BTW did you try in your code instead of off ?
RewriteCond %{HTTPS} on
I've change to this lines and it works:
RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
I hope will works correctly finally
@patryk_przebiro
Did it work completely?
then please mark as solution so it will help to others as well.