Google Answers Logo
View Question
Q: .htaccess Domain Redirects ( Answered,   0 Comments )
Subject: .htaccess Domain Redirects
Category: Computers > Internet
Asked by: niallr-ga
List Price: $10.00
Posted: 08 Mar 2006 08:52 PST
Expires: 07 Apr 2006 09:52 PDT
Question ID: 704962
Hi, I'm looking for information on how to do a .htaccess redirect from
one domain to another.

For example if I wanted to redirect all the traffic from to

I know this can be done page by page with redirects but I'm looking
for a solution to redirect the entire domain to another one.


Subject: Re: .htaccess Domain Redirects
Answered By: palitoy-ga on 08 Mar 2006 09:42 PST
Hello niallr-ga,

Thank-you for your question.

If I understand your question correctly you need to alter your
htaccess file to redirect a domain to another domain.  These types of
request are notoriously difficult to troubleshoot online so if you
have a problem with the code below please do not hesitate to ask for

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?something\.com 
RewriteRule ^(.*)$$1 [R=301,L]

The above code should be copied into an htaccess file and uploaded to
the root directory of your server.

The code means that if the URL that the user enters matches or then all of the pages the user
tries to access will be redirected to the same page at  The [R=301,L] means that the server is
sending a 301 redirect (that is the page is permanently redirected)
and the "L" indicates this is the last rule.

Once again, if you need any further assistance on this matter please
do not heistate to ask for clarification.

Further reading:
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy