Redirect Old Domain to New Domain

Discussion in 'Search Engine Optimization' started by alokseo, Jan 6, 2012.

  1. #1
    How to Redirect Old domain to New domain through .htacsess? Here are few code types which would allows to your website old domain to new domain. You should add this code in .htaccess file

    Method First:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^olddomain.com [NC]
    RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
    RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
    RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]

    Method Second:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} \olddomain.com$
    RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L

    Method Third:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

    Method Fourth:
    Redirect 301 / http://www.newdomain.com/
     
    alokseo, Jan 6, 2012 IP