Sunday, June 27, 2010

Redirect one domain to another using .htaccess

Are you looking for redirecting your website fromone domain to another ? I was working for client who has a domain in .com and now they want to move full website into .ie domain. The problem is that all links has been crawled by major search engine. So if we remove all files from .com domain than it shows 404 not found (broken links) for .com domain links. Also we have to remove files to avoid duplicate content issues.

The solution is to redirect all request from .com to .ie. So we need to write rules in .htaccess file of .com domain which redirect all request from .com to .ie and we will not loose the visitors. Below are the rules which is useful forredirecting from one domain to another domain.


Options +FollowSymLinks
RewriteEngine on

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

Comment below if you have any query.

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database and Open-source, enter your email address below. We will send you free tutorials.


Source link : http://www.programmingfacts.com/2010/03/09/redirect-domain-htaccess/

No comments: