Search code examples
iisurlurl-rewritingisapi

Trying to map subdomain to another using ISAPI Rewrite on IIS 6


I've been experiementing with URL rewriting in IIS 6 and 7. On IIS 6, I've been using ISAPI Rewrite 3 and am trying to map URLs for one subdomain to another e.g.

http://subdomain1.domain.com/*

would be mapped to:

http://subdomain2.domain.com/*

I've tried to achieve this using:

RewriteEngine on

RewriteCond Host: subdomain1.domain.com RewriteRule (.*) subdomain2.domain.com/$1

but nothing seems to happen or show up in the IIS log or rewrite.log. I must be missing somethin to enable logging here - any ideas? Also, if anyone could suggest why my rules don't seem to be working it would be much appreciated.

One further question (sorry!) - was wondering on IIS 7 using the rewrite module, I can use the rewrite rules to redirect to content hosted on another instance of IIS (on a different server machine) but can't use the rewrite action to simply mask the URL - is this possible? At the moment, I'm just getting a 403 - forbidden error.

Many thanks for your help.


Solution

  • With regards to your second question about rewriting on IIS 7, you can use the Application Request Routing module to set up a reverse proxy between 2 servers so that content requested from the first server is seamlessly served from the second server.

    http://learn.iis.net/page.aspx/489/using-the-application-request-routing-module/