HostOnNet Blog

Redirect OLD domain to NEW using .htaccess

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} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule (.*)$$1 [R=301,L]

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

Redirect 301 /old-page.html

See Htaccess Tips and Tricks

Posted in Apache