Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I own 2 domains and

What i want to do is redirect all the subdomains from 1st domain to 2nd domain. eg. to but i dont want to redirect to and also dont want to redirect to

Please help

I am using this code in htaccess but it is not working.

RewriteCond %{HTTP_HOST} ^(.*)sio-india\.org$ [NC]  
RewriteRule ^(.*)$$1 [R=301,L] 

Please hepl me I am stuck.

share|improve this question

migrated from Jun 15 '10 at 13:06

This question came from our site for professional and enthusiast programmers.

Are any redirects working? I.e. is the web server set up to respect rewrites defined in .htaccess? – Lauri Lehtinen Jun 15 '10 at 4:08
So to summarize: redirect: // to //; Leave // alone; Leave // alone. Any other variations? What about www variations? And do all these sites live in the same webroot? – artlung Jun 15 '10 at 4:23

1 Answer 1

It would be helpful to specify how exactly is it not working. It seems to me that your code would redirect everything (including This is because .* means "any character, zero or more repetitions", so would match too.

You should change your condition to

RewriteCond %{HTTP_HOST} ^(.*)\.sio-india\.org$ [NC]  
RewriteRule ^(.*)$$1 [R=301,L]

If that doesn't fix it - please be more specific about how it doesn't work.

share|improve this answer
Thanks it works perfecttly! I am using it on one of my sites. Was looking for a very long time. – user172109 May 2 '13 at 9:33

Your Answer


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