1
1
16Gb2017-08-05 22:13:01
htaccess
16Gb, 2017-08-05 22:13:01

Why does a redirect from www to non-www work?

RewriteEngine On
RewriteCond %{HTTPS_HOST} ^www.mydomen.ru$ [NC]
RewriteRule ^(.*)$ https://mydomen.ru/$1 [R=301,L]
RewriteBase /
RewriteRule ^sitemap.xml$ index. php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ! .*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Redirect www to non www
But this code not working
RewriteCond %{HTTPS_HOST} ^www.mydomen.ru$ [NC]
RewriteRule ^(.*)$ https://mydomen.ru/$1 [R=301,L]
What are the options?
I have already tried a bunch of options from Google for a redirect, nothing works. No ngix.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Petrov, 2017-08-05
@Dragmar

Redirect from WWW to non-WWW

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.site\.ru [NC]
RewriteRule ^(.*)$ http://site.ru/$1 [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question