How to do 301 RDNs?
Hi there,
I have redirected the URLs https://abc-xyz-2-127.ip.linodeusercontent.com/ to my homepage in htacess with this code
RewriteEngine On
RewriteCond %{HTTP_HOST} !^abc.com$ [NC]
RewriteRule ^(.*)$ https://abc.com/$1 [L,R]
but upon checking the redirect is 302 not 301. How can I fix this?
1 Reply
tlambert
Linode Staff
Based on the information I could find, 302 is a temporary redirect and 301 is permanent. To make your 302 a 301, you'll want to add the following code to the end of your RewriteRule
in .htaccess:
[R=301,L]
According to the folks a mediatemple.net,
"this performs a 301 redirect and also stops any later rewrite rules from affecting this URL (a good idea to add after the last rule). It's on the same line as RewriteRule, at the end."
Hope this helps!