Answer the question
In order to leave comments, you need to log in
301 redirect from www to non-www with https?
Tell me .htaccess like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI } [R=301,L ]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI } [R=301,L]
the task is to redirect all requests from www and without www to https
without www everything works, but with www
adds /public_html/
from that error like
Not Found
The requested URL /public_html/ was not found on this server.
help solve the problem.
Answer the question
In order to leave comments, you need to log in
Is there no option here? https://web-optimizator.com/301-redirekt-htaccess/
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
!=on does not always work, but off more often and in general this redirect is written in dozens of ways, choose the one that suits your server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question