1

This is for IIS6 or IIS7. I want to map a domain to a subdirectory.

For example:

http://www.example.com/dir1/test.aspx

I want to strip out the "http://www.example.com" part and redirect to a relative url, like "proj1/example/dir1/test.aspx". If that won't work, then replace with "http://www.example2.com/proj1/example/dir1/test.aspx. The user's url display must not change.

I know this has been done a million times but I've never worked on this.

1 Answer 1

4

There are two concepts. One is a redirect (client-side) and the other a rewrite (server-side).

A redirect can redirect from one domain to another. But a rewrite must be within the same site. It can't cross domains.

Well, actually you do have an option for cross-domains. That's a reverse proxy like ARR (IIS7 only).

Here's a post on how to rewrite to a different path while retaining the URL in IIS7.

In IIS6 you'll need to use a tool like ISAPI Rewrite www.isapirewrite.com.

2
  • I used the web.config sample from the post you referred to, edited it for my domains, and it immediately solved the problem.
    – P a u l
    Feb 10, 2011 at 16:31
  • Excellent, glad to hear. Feb 10, 2011 at 17:00

You must log in to answer this question.

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