Answer the question
In order to leave comments, you need to log in
How to implement a 301 redirect correctly?
There is a site with implemented CNC (I will show on the example of one page).
Here is the NC implementation on one of the pages:
AddDefaultCharset UTF-8
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^news/(sport)$ /pages/news.php?type=sport [L]
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Answer the question
In order to leave comments, you need to log in
301 redirect set higherRewriteRule ^news/(sport)$ /pages/news.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteRule ^news/(sport)$ /pages/news.php?type=sport [L]
redirect from www to non-www with https
RewriteEngine on
RewriteCond %{HTTPS}_%{HTTP_HOST} ^(?|off_(?:www\.)?(.*)|on_www\.(.*)) [NC]
RewriteRule .* https://%1/$0 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question