One of the tools in my tool box is xampp, which seems to work better than trying to install everything bit by bit (at least it did at work). One thing I never considered was setting up virtual hosts for each project, I always worked from a folder so that to access the site I went to:
That is fine, but what happens when you are working with a site that needs to be the root site (ie: it has links like /page_name.php which bounce you out to the root)? In that case you need to set up a virtual server. In xampp they have separated the files out to ‘make it easier’ on a user to find what they want. Sometimes this is not the case… so here is how to setup a virtual server (at least it worked for me) on Windows Vista (and XP, and with some small modifications Linux and Mac as well).
Find the httpd-vhosts.conf file, it should be:
if you installed it in the default location.
Then go to the bottom of that file and add:
<VirtualHost *:80> ServerName http://sitename.127.ca DocumentRoot C:\xampp\htdocs\sitename </VirtualHost>
if that doesnt work, then there might be something in the http.conf files that is stopping access to that folder, in that case, add
<Directory C:\xampp\htdocs\sitename> IndexOptions +FancyIndexing NameWidth=* Options Includes FollowSymLinks Indexes AllowOverride All Order allow,deny Allow from all </Directory>
So, you have:
<VirtualHost *:80> ServerName http://sitename.127.ca DocumentRoot C:\xampp\htdocs\sitename <Directory C:\xampp\htdocs\sitename> IndexOptions +FancyIndexing NameWidth=* Options Includes FollowSymLinks Indexes AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
While you can probably put the site in any folder on your computer, it makes sense organizationally to keep them all in the htdocs folder (at least it does to me…), so that is why the example uses the path
You should now be able to access your site by going to:
For why 127.ca see this site.