I am with skjaidev in that matter. The best and easiest way for you, should be to setup vhosts. Which is fairly simple. All you need to do is:
1.) Deactivate the ServerRoot
and DocumentRoot
directives in the httpd.conf
(or apache.conf
, or however the master configuration file is called on your system). Deactivate means either delete the line, or preferably put a '#' infront of it.
2.) Deactivate the corresponding <Directive...>
container. You can find them as they have the same path as your DocumentRoot
.
Those two steps are not required, but i do it this way for some reasons
3.) Include a new file called vhost.conf
or use the one offered by your installation. You can achieve this by adding the following line in your httpd.conf
Include "C:\Path\to\apache2\confdir\vhost.conf"
4.) Add NameVirtualHost *:80
on top of the vhost.conf
(exactly one time) with 80 being the port you want the apache to listen to
5.) Add a <VirtualHost ...>
container like this.
<VirtualHost *:80>
ServerName site1.local
DocumentRoot "C:\Users\GSTAR\Documents\Web Sites\Site1\"
DirectoryIndex index.html index.php
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:\Users\GSTAR\Documents\Web Sites\Site1\">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This is just an example configuration. You have to adjust this to fit your needs.
6.) Add as many <VirtualHost ...>
containers in above's style as you want. Just adjust the DocumentRoot
and Directory
directives
7.) To make the site1.local
and site2.local
work you will have to either edit your hosts file, or modify your local DNS server. In case you are using Windows 7, you can access this file by right clicking your preferred editor and start it with administrator rights. If you don't, you can't edit it. Now you open it by browsing to C:\Windows\system32\drivers\etc\hosts
If you need further assistance just leave a comment.