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 am setting up a couple micro sites that I would like to have their own url associated with. How can I redirect that url to a sub folder of an existing site?

for example, i might like to redirect http:/ =>

share|improve this question
Yes, sorry should have included the server; IIS 6.0 I think I may just use the host header redirection route suggested by mpbloch. – user14323 Jul 24 '09 at 19:00
This how, for example, Office Live Small Business, and Google Apps for custom domains work. – mpbloch Jul 24 '09 at 22:13
up vote 4 down vote accepted

You must have control of how the Web server handles requests at

You then set up a conditional based on the HOST header, and set up a redirect to the path.

In your dns, you can use a CNAME to redirect "www" in to "". Or, to "", for example, and set up your redirects on the web server to look for "(MATCH)" and redirect to the path "/(MATCH)".

share|improve this answer

You can do this in apache with mod_rewrite

RewriteRule   ^www\.applesandstuff\.org(.*)$$1 [NC,R,L]

About the flags:

  • NC: Not case sensitive
  • R: Redirect, change the url shown to the user. This is the opposite of proxy [P]
  • L: Final redirect, Don't apply any other rules if this matches.
share|improve this answer

You could use a basic 301 redirect in your .htaccess file that says something like the following:

redirect 301 /

That will take anything going from the root of the site and redirect it to your other site

share|improve this answer

Request for more information: what web server are you using to serve the sites?

share|improve this answer

If you are using apache you want to use mod_rewrite

share|improve this answer

Agree with other posters, it really depends on what web server you are using. Even within IIS there are multiple ways to do it depending on which version of IIS you are running.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.