Page 1 of 1

WAMP; HOSTS and httpd.conf files...

Posted: Sat Nov 28, 2009 10:41 pm
by Wolf_22
I have a WAMP installation that I use to work on my websites before I upload them. A particular project I'm working on requires the modification of the HOSTS and httpd.conf files. The reason for this is due to sub-domains.

This website will be reachable by 4 keywords. Each keyword will forward the user onward to a specific place on the website (i.e.- a training section, forum section, etc.).

In my HOSTS file, I have the following:

Code: Select all

127.0.0.1   localhost
127.0.0.1   subdomain1
127.0.0.1   subdomain2
127.0.0.1   subdomain3
127.0.0.1   subdomain4
In my httpd.conf file, I have the following sections:

Code: Select all

<VirtualHost *:80>
    DocumentRoot "C:/WWW/websites/company/drupal/"
    ServerName subdomain1
</VirtualHost>
 
<VirtualHost *:80>
    DocumentRoot "C:/WWW/websites/company/drupal/"
    ServerName subdomain2
</VirtualHost>
 
<VirtualHost *:80>
    DocumentRoot "C:/WWW/websites/company/drupal/"
    ServerName subdomain3
</VirtualHost>
 
<VirtualHost *:80>
    DocumentRoot "C:/WWW/websites/company/drupal/"
    ServerName subdomain4
</VirtualHost>
As you can probably tell from the above, this is a Drupal multisite configuration.

The problem that I currently have is with the HOSTS and httpd.conf files. Whenever I travel to "http://localhost", the browser forwards me directly to the Drupal path when it should instead forward me to the "WWW" root the way it did before I entered the additional bits in the two noted files.

What's causing this? Is it the port forwarding above or is there something wrong with my HOSTS file???

Any help with this is greatly appreciated because it's making me pull my hair out! :chomp:

Re: WAMP; HOSTS and httpd.conf files...

Posted: Sun Nov 29, 2009 12:36 pm
by Wolf_22
I solved the problem.

It boiled down to having WAMP (Apache) listen to a specific port. I added a listen directive of "8080" and then modified the port forwarding within the VirtualHost directives to listen to the 8080 port. This allowed me to have my normal setup of localhost within the addy bar while also allowing me to make URLs of the appropriate sub-domains through using port 8080 (i.e. - "http://blah:8080").

:)