Redirect domain alias to a particular folder in Windows

Often you may need some kind of redirection for your URL’s to a particular folder where you are going to use files and applications that differ from your main domain.
If fact this is often used in the search engine optimization for one or another purpose, or you can use it to cheat hosting companies if they are too expensive or with good quality, but small amount of present services.
No matter what are your intentions, in thit tutorial I will talk about redirecting domain alias to a particular folder under Windows.

Basically this is ASP script that checks what is the domain (Web server request) that the request is coming from and then using ‘if – then’ sequence it will be forwarded to a particular folder.

Let’s say you have ‘’ as your main domain and then you have ‘’ pointed to ‘’ as domain alias. (Referral tutorial is: Create domain alias in IIS on Windows server ).
Then you want this domain alias to open a different folder than the main domain and your visitors to remain with the filing that this is totally separated domain, as in the same time your are going to use the same hosing, the same server, and the same IP address.

Well, just check the next code (that I am using on one of my servers):

Even if you are totally newbie, you will notice that every domain alias is involved in a condition which says – if this request is coming from this domain alias, then redirect to domain’s sub-folder.

So if the request is from which is alias of it will go to folder which exist also as

What happens is that the domain alias is using the main domain hosting, but under this sub-folder – there is a totally different index fail which seams to stand only for the domain alias.
In other words using that way, when there is a visitor of the domain alias, he will not be aware that actually this is a folder under a totally different (main) domain.

Using this way to redirect domain alias to a particular sub-folder you can basically have one hosting and many hosted domains.

Filed Under: Windows 2003 Server

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Leave a Reply