Google Answers Logo
View Question
 
Q: .htaccess Domain Redirects ( Answered,   0 Comments )
Question  
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
www.something.com to www.somethingelse.com

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.

Thanks

Niall
Answer  
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
clarification.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?something\.com 
RewriteRule ^(.*)$ http://www.somethingelse.com/$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
www.something.com or something.com then all of the pages the user
tries to access will be redirected to the same page at
http://www.somethingelse.com.  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:
http://www.widexl.com/scripts/documentation/mod_rewrite.html#redirect_domain
http://www.serve.com/faq/index.php?faq_option=faq&id=95#rewrite
http://www.olate.co.uk/articles/259
http://www.gnc-web-creations.com/301-redirect.htm
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Comments  
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 answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


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