Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have several domains at no-ip.org, lets say NAME1.no-ip.org and NAME2.no-ip.org. 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
add comment

1 Answer 1

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 = "www.edwardhilsum.com"
eds2 = "edwardhilsum.com"

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

response.redirect("edward/default.htm")

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
add comment

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.