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

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!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct