Developing multiple websites on a localhost

Developing on your local machine is actually a lot simpler than it sounds. Xampp for windows is a fantastic tool that will let you set up a local apache server environment with PHP and MySQL in a few simple steps.

This really is a great time saver as you can make changes and test things before uploading to your site. This also means that you have a local backup of your site at all times which can really come in handy if there is ever a problem with your host.

I fell in love with a local environment, after years of making a change, uploading via ftp, refreshing, debugging, uploading again, refreshing I was now able to test, debug and develop in a fraction of the time. The next thing I needed was the ability to manage multiple sites. I came across a fantastic article – – that explains how you can create multiple websites on your localhost.

The summary of that article is:

Change your httpd-vhosts file – C:\xampp\apache\conf\extra (path may change depending on your xampp install).

So if you want to set up a site called “mysite” add the following at the bottom of the file:

<VirtualHost *:80>
DocumentRoot “C:/xampp/htdocs/mysite”
ServerName localhost.mysite

Change your hosts file – C:\Windows\System32\drivers\etc

Look for: localhost

And add your website under that line: localhost localhost.mysite

Now you just need to restart apache from the Xampp control panel and you are all set, you can now go to http://localhost.mysite in your browser and see your website.