Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

Can I direct user to a specific folder depending on what domain they requested?

I have several domains at, lets say and In my default web folder i have two sub folders, one of each of the domains. Could I in any way redirect them to the correct folder depending on what domain they are trying to browse?

If it matters i have set up ISS7 with PHP :-)

share|improve this question
up vote 2 down vote accepted

Yes and no...

Easiest method - if you control the server, set up a different site with a different host header for each site you want... For example:

enter image description here

If however you can only have a single site, I would recommend using a quick and dirty ASP file as follows (Copy and paste for each domain required):


eds = ""
eds2 = ""

if request.servervariables("SERVER_NAME") = eds or request.servervariables("SERVER_NAME") = eds2 then


end if


For example, renamed the variable eds and eds2 to be unique for each site and change the headers to what you want the site to respond to... then change the eds and eds2 in the actual detection if loop, and finally, change the response.redirect to whatever page/folder you want. In this example, it will redirect to the default.htm document in the edward folder.

Hope this helps and I have covered two possibilities for you.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .