• Hello..I need to change my domain name – and have do a 301 redirect from the .htaccess file from my ‘old’ domain site….I want to make sure i do this properly to avoid any seo penalties…but, im confused on what is the exact code i’m suppose to use?…I keep seeing different variations online, and not sure which one is best to use to avoid any issues and redirecting everything properly?…

    Two variations below:

    #Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^(.*)$ http://www.newsite.COM/$1 [R=301,L]

    OR

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
      RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
      RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
    </IfModule>

    …or is there a better & proper line of code I should use?

    Any help would be appreciated. thanks!

The topic ‘Which 301 Redirect Code in .Htaccess file?…’ is closed to new replies.