HostOnNet Blog

Redirect OLD domain to NEW using .htaccess

Looking for Linux Server Admin or WordPress Expert? We can help.

When you move your web site form one domain to another, you need to redirect all visitors on your old domain to new one to avoid lose of traffic. Google recommend using 301 redirect when you change URL of a web page.

To do this create .htaccess file with following content.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^OLD-DOMAIN.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.OLD-DOMAIN.com$
RewriteRule (.*)$ http://www.NEW-DOMAIN.com/$1 [R=301,L]

If you only need to redirect few page on your web site, use Redirect option.

Redirect 301 /old-page.html http://www.new-domain.com/new-page.html

See Htaccess Tips and Tricks

Posted in Apache

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.