I have a server with IIS7 that I am using to host several different sites for testing. Due to an overabundance of bureaucracy, I am unable to use host headers (I can't get new entries on our internal DNS server and users can not change their local hosts file).
I have set up the default site in IIS to have nothing but virtual directories that have test versions of my sites
Default Site
---> TestSite1
---> TestSite2
So when I ask the test user to test a site I tell them to go to http://testserver/testsite1
The problem is that the sites use virtual paths everywhere so they don't work right. For example, the site is looking for the style sheet using /css/main.css
but it won't find it because there is no /css
folder on the root of the default site. There are far too many things like this to fix to change how the site works.
Will IIS7 URL rewriting help me here? If so, what do I use for the regex pattern?
I don't think rewriting will help you in this situation.
If you can change the code you can do something like add
<base href="http://testserver/testsite1/" />
to the <head>
tag of your master template (if you have one) so the absolute root / will always resolve to the correct virtual directory.
I've also seen people use code like get_img('button.jpg')
which will resolve the correct path through server side logic.