Running multiple web-sites in your local WAMP root folder

Confused already? Of course, I’ll try to explain, so suggest a better title if you wish. If you’re using WAMP server on MS Windows (perhaps this would be even simpler to do on Linux) like I do, sometimes you add new applications to new folders in your default root folder of your WAMP server, for example:

  • c:wampwwwapp1
  • c:wampwwwsite2

which are respectively accessible from the follwing URLs:

  • http://localhost/app1/
  • http://localhost/site2/

Sometimes you will need to run an application in your root folder (http://localhost/). Sometimes you will need to run multiple applications or websites in your WAMP root folder, and since you can’t run multiple websites in your root at the same time, what would be the easiest way to switch between rooted applications?

You can do this:

  • create a set of batch scripts which would make switching websites in WAMP root fast and easy
  • and an added bonus you can even modify your hosts (c:WINDOWSsystem32driversetchosts) file to have the www.mylatestsite.com requests redirect to localhost

Main advantage of these two things is that you can develop the website locally and just deploy it to the live server without any patching for absolute URLs to your local server. More on running multiple web-sites in your local WAMP root folder