Hello, I always get 500 configuration error every time I try to put the Virtual Host into my .httaccess. I’m trying to achieve subdomains on my local machine.
Something like
http://blogs.localhost/
Here is the code that I’m trying to work with. I’ve got it from http://www.sitepoint.com/forums/showthread.php?394472-Setting-up-Subdomains-on-Localhost-Apache
<VirtualHost 127.0.0.1>
ServerName blogs.localhost
DocumentRoot "C:/dev/www/blogs"
</VirtualHost>
I keep getting 500 configuration error even after this.
Yup. I’ve tried both. I keep getting the same 500 error.
I don’t know why I missed that the first time. I guess I wasn’t expecting it.
I believe that VirtualHost directives may only be placed inside server configuration files, not inside per directory htaccess files.
http://httpd.apache.org/docs/current/mod/core.html#virtualhost
Ok thanks. I got it to work. I had to use my server configuration in my Apache folder. Thanks a lot. I thought it was an .htaccess command.
For others,
Creating a VirtualHost on a test server (yes, a subdomain is another VirtualHost), you need to edit TWO files: httpd-vhosts.conf and hosts (no extension).
CD picked up the port which is required (I prefer to specify 127.0.0.1:80) but both files are well commented. Copy an entry and edit it for your VirtualHost then save.
WinDoze users:
-
WinDoze protects a number of directories so (1) don’t install Apache in Program Files.
-
The hosts file exists in C:\Windows\system32\drivers\etc as hosts. Open a text editor (RUN AS ADMINISTRATOR) then open the hosts file, edit, and save. If you don’t do this as “Administrator,” WinDoze will NOT save your edits.
Regards,
DK