Answer the question
In order to leave comments, you need to log in
How to fix incorrect redirect from www?
Hello dear experts!
The redirect to www does not work correctly on the site. For example, site.ru/razdel is redirected to http://www.site.ru, while /razdel/ gets lost somewhere.
I am far from such technical issues, so I beg you to suggest how you can make the redirect to www work fully.
.htaccess:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteCond %{HTTP_HOST} ^site.ru [NC]
RewriteRule ^(.+[^/])$ http://www.site.ru/$1/ [QSA]
redirect 301 /index.php/ http://www.site.ru
Answer the question
In order to leave comments, you need to log in
Instead of:
RewriteCond %{HTTP_HOST} ^site.ru [NC]
RewriteRule ^(.+[^/])$ http://www.site.ru/$1/ [QSA]
redirect 301 /index.php/ http://www.site.ru
RewriteCond %{HTTP_HOST} ^site.ru
RewriteRule (.*) http://www.site.ru/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question