Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Title says it all really, I want to be able to 301 redirect from subdomain.domain1.com to domain2.com.

I have full access to the servers and have tried various things using .htaccess but have had no success.

The reason for this is because I have a site that was hosted on a subdomain but has since moved to its own domain and I want to redirect any requests to the right place. How would one go about achieving this?

share|improve this question
    
What HAVE you tried? –  Dan Oct 27 '11 at 11:47

2 Answers 2

up vote 2 down vote accepted

It should be just a case of putting something like the following in

redirect 301 /index.htm http://domain2.com/index.htm

Though you can also do stuff with mod rewrite to catch all requests.

share|improve this answer

In your httpd.conf file, inside the vhost that serves subdomain.domain1.com:

Redirect Permanent / http://domain2.com/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.