How to configure subdomains
Posted by: spaz (---.190-31-37.telecom.net.ar)
Date: December 26, 2007 08:38PM

I need to be able to access the server like this:

http: //something.localhost/

http: //something_else.localhost/

http: //etc.localhost/

I know how to configure this in VirtualHosts, but WAMP doesn't use them.

Basically I'd like to be able to access the same page with any subdomain possible (and then I already have a working script that will tell me what subdomain people came from)

(Note: The forums was parsing the URLS so I inserted a space after the colon)

How is this achieved?

Options: ReplyQuote
Re: How to configure subdomains
Posted by: yfastud (Moderator)
Date: December 26, 2007 09:24PM

Quote

I know how to configure this in VirtualHosts
So just go ahead and enable it

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: How to configure subdomains
Posted by: spaz (---.201-253-221.telecom.net.ar)
Date: December 27, 2007 08:37PM

Well, I don't really know how to enable it but I gave it a shot and Apache started, which is a good sign taking into account that I have no Idea what I'm doing.

Still, I'm not being able to access subdomains sad smiley

This is what I have so far:

---------------
NameVirtualHost *:80

<VirtualHost *:80>
ServerAlias *.localhost
DocumentRoot "E:/n/htdocs/"
</VirtualHost>
---------------

The DocumentRoot here is the same as my "main" server config.
Any help is greatly appreciated.

Options: ReplyQuote
Re: How to configure subdomains
Posted by: yfastud (Moderator)
Date: December 27, 2007 09:15PM

To enable vh, open file httpd.conf in C:\wamp\bin\apache\apache2.2.6\conf and find these lines:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Uncomment the second line to become:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Then open httpd-vhosts.conf in C:\wamp\bin\apache\apache2.2.6\conf\extra and replace those 2 dummy vh as follows:

<VirtualHost *:80>
ServerName www.first_domain.com
DocumentRoot c:/wamp/www/first_domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.second_domain.com
DocumentRoot c:/wamp/www/second_domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.third_domain.com
DocumentRoot c:/wamp/www/third_domain
</VirtualHost>

<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
</VirtualHost>


Make sure to have associated folders in c:/wamp/www and put all your files in there, then restart your wamp to take effect.

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.