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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I will put it as simple as I can. I really need your help, so one of the domains let's say is set to point to, basically what happens is when you type into your browser it will redirect you to

So basically I need and if that is even possible. I would like to write htaccess file on the so that according to different requested URL points it to certain subdomain, let say if you type in your browser it should bring you to

My question is if that is even possible to do and if so HOW TO DO IT, I tried something like this but it didn't happen:

RewriteCond %{HTTP_HOST} ^ [NC]

RewriteRule ^(.*)$ [L,R=301]

Is that even a right approach? Can this be done, if so, every help is very much appreciated. Sorry if the topic is already somewhere I tried it but didn't found it.

P.S. I don't have access to htaccess file it just redirected to I assume with

Thank you in advance for the help.

share|improve this question

If I understand correctly, the .htaccess file on should evaluate where the request is coming from, so I'd give it a shot with testing against the "referer" header in the HTTP Request:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://example\.com [NC]
RewriteRule ^(.*)$ [L,R=301]

I'd consider catching, too.

share|improve this answer

Your Answer


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.