Answer the question
In order to leave comments, you need to log in
What should be a 301 redirect?
Greetings.
It is necessary to configure the redirect correctly so that the site opens https://site.ru/folder
1. Redirect from www to without www ;
2. Redirect from http:// to httpS:// ;
3. Redirect from /index.html to without /index.html ;
4. Removing "/" at the end of folders.
In .htaccess, this is the code:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Protocol} !=https
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule .* http://%1/$0 [L,R=301]
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ %1 [R=301,L]
Answer the question
In order to leave comments, you need to log in
I wrote everything here
https://klondike-studio.ru/standards/standartnyy-h...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question