Forwarding from https://www on https without www
As through .htaccess configure redirects with https://www on https without www ?
1
2 answers
Try this way
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L,QSA]
Or
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} on
RewriteRule .* https://ДОМЕН.ru%{REQUEST_URI} [R=301,L,QSA]
4
Author: Visman, 2016-08-19 02:51:08
Solved the problem like this: Created a separate domain with WWW, received a certificate for it and in the www domain via .htaccess added a redirect
RewriteEngine On
RewriteCond %{HTTP_HOST} !^ИМЯ_САЙТА\.ru$ [NC]
RewriteRule ^(.*)$ https://ИМЯ_САЙТА.ru/$1 [L,R=301]
A year later, for unknown reasons, an error appeared when switching to http and I did this:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
1
Author: Get-Web, 2017-11-22 18:44:49