A
A
Anto2018-10-24 11:13:27
1C-Bitrix
Anto, 2018-10-24 11:13:27

How to set up a 301 redirect from www to non-www?

Good afternoon!
I read a lot of articles but could not set up the correct redirect from www to without www, tell me how to do it.
Registered in .htaccess:


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

Everything seems to be working, but if you enter (paste the copied link) www.site_name.ru/catalog/kater-rib/ or another section, a 404 error is issued. When you go through the menu items on the site, everything works.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Polyansky, 2018-10-24
@git507

I made a gluing for the client according to this guide, the subsequent feedback confirmed the correctness of the methodology.

V
Viktor Taran, 2018-10-24
@shambler81

.htaccess is read from top to bottom, moreover, in a circle until the generation of urls stops completely.
Therefore, the location of the directive matters.
All .htaccess to studio

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question