tags:

views:

46

answers:

2

I have no idea how to search for this one and perhaps Serverfault would be better but I'll start here.

I have a HTML web site running at the root of one of my webservers. It runs fine and dandy. I needed to make a test environment for it and where I can't run it in the root of the websever. I have to make a directory on the test server. For instance:

http://myTestserver/HtmlWebsite/index.html instead http://myProdserver/index.html

Once I throw it into the directory, most everything breaks. Some images won't load, javascript files can't be found, mass hysteria!

I discovered that the author of said site had used a mix of absolute and relative directory paths in all the files hence why some images loaded correctly.

I can go in and edit all the files to be relative. But I'm wondering if I can make IIS 6.0 think that the web app directory it is in is the root of the webserver. So if I have an absolute path in the HTML like:

<img src="/_support/loadme.jpg" />

it would give me the image for either http://myTestserver/HtmlWebsite/%5Fsupport/loadme.jpg or http://myProdserver/%5Fsupport/loadme.jpg.

Can I get IIS 6.0 to do my bidding or am I stuck editing paths?

A: 

Unfortunately you'll either have to fix the absolute URL's across the site or run the site in it's own website in the root.

Is there no way you can get a new site created on the IIS6 test server?

Kev
I have one Test server. I suppose to can create a new website on the server, using a different port?
KeithA
That would work, but why not just host headers for the new site?
Kev
A: 

You should be able to by using URL rewriting

First you install ISAPI Rewrite, found here: http://www.helicontech.com/isapi_rewrite/

Then you create a config with the following rule:

RewriteEngine on    
RewriteRule (.+) /HtmlWebsite$1

What it does is it takes your request, say /index.html, and internally rewrites it to /HtmlWebsite/index.html, which is (ironically) tricking you into thinking you're calling from root when in fact it fetches it from the subfolder.

You might have to add or change the rule if you got more stuff on your test server, but that's the gist of it.

Shane
That's an interesting tool. Will have to remember that. But I think I'll have to go with just creating another web site and using another port to access it on the same server.
KeithA