ArtcoInc
ArtcoInc

Reputation: 31

IIS virtual directory home different than Apache

I have a site I developed on a WAMP server in house, and is hosted offsite (presumably on an Apache server). The site was created in the root directory of the WAMP server (C:\wamp\www). I'm now trying to move the in house development site onto a Windows Home Server v1 box (essentially a Server 2003 machine running IIS 6). I'm trying to not have two different versions of the site: one for in house (on IIS), and one for hosting offsite (on Apache).

On the WHS machine, I have a virtual directory <sitename> located at:

c:/inetpub/<sitename>

I can access it on the server at:

Localhost/<sitename>

and from anywhere on the LAN at:

<ServerName>/<sitename>

When I initially wrote the site, I used the ../ declaration for almost every file, path, directory, and PHP include files. This works fine on the WAMP server and on the offsite host. But, when I moved the site into the virtual directory <sitename>, it fails on the IIS server.

All such ../ references point to the server root:

<ServerName>/

rather than site home:

<ServerName>/<sitename>

Presumably, I could move the site into the 'root' directory: c:/inetpub/wwwroot, but Windows Home Server uses this for something else.

I could change every reference from ../ to ../<sitename>/, but that would mean having 2 different sites to maintain, one for in house and one for offsite.

So, my questions are ...

  1. Is there any way to declare that the virtual directory c:/inetpub/<sitename> is the home or root directory for this single site? Is there a configuration in IIS that will do this for this one virtual directory, and not upset the other sites hosted on this server?

If not;

  1. Can someone point me to some other way to rewrite the site in order to have it run on both Apache and IIS 6 with no/minimal alterations for the two different servers?

I have been searching for over a week on this. All of the solutions that I have found are specific to either Apache or IIS, but won't work in both.

Thanks!

Upvotes: 2

Views: 537

Answers (1)

ArtcoInc
ArtcoInc

Reputation: 31

Ok, here's a -possible- answer ...

I changed every ../ to a PHP include statement, calling a file I named SiteBase.txt.

On the IIS server, SiteBase.txt consists of a single line: http://<ServerName>/<sitename>/.

On the WAMP server, SiteBase.txt consists of a single line: ../

This way, I only have to change this one file when I move the site from my development server to the production server. A bit Brute-Force, but it seems to be working.

Does anyone see a problem with this?

Thanks!

Upvotes: 0

Related Questions