We help IT Professionals succeed at work.

Redirect to different folder, depening on domain name?

Hello all,

Im not sure what im really asking for but. If i have a webserver with ip address: and on this i want multple sites hosted. Depending on the domain name can i redirect it to a different folder? or say "look in this folder, for this domain name". If you know what i mean? I think there may be some kind of .htaccess things i can do?

i haz..

http://www.example1.com ->
http://www.example2.com ->
http://www.example3.com ->

All pointing to the same thing, but 3 totally different websites all located in different folders, how can it be pointed to a specific folder?

I hope i make sense:)



edit: the above obviously is an example, 3 is not an exact figure im just looking for a way to do the redirect or point to this folder based on the URL, if even possible
Watch Question

Yes. I only have experience with IIS, but it is definitiely possible with IIS, and should be fine with the others.


Do you know how to do with .htaccess? codes?

Sorry, I missed that part of the post.
If you are using Apache, you can define virtual hosts in the apache conf file for the web server.  Using either virtual hosts, mod_rewrite or mod_proxy you can probably do what you would like to do in the example.

Depending on your server setup and needs, you may want to make the changes in the apache conf instead of trying to make this happen in .htaccess files.