O
O
Obivankinobi2017-08-17 22:43:13
htaccess
Obivankinobi, 2017-08-17 22:43:13

How to configure htacces to redirect to the non-www version?

Good afternoon.
The problem is that for pages like www.site.ru/ggg.html the redirect goes to site.ru/ggg.html as it should be,
but from pages like www.site.ru/catalog/ggg.html the redirect does not work, that is, you type www.site.ru/catalog/ggg.html and it does not remove www.
How to solve this problem?
And also recommend what to read on htacces ..
The following is written in htacces

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

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-08-17
@zkelo

Try like this:

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question