3
votes

Im trying to set up a virtual host using my local xampp stack but after following many tutorials i simply can't work out where im going wrong.

Here is what i added to my httpd-vhost.conf file:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot E:\Programs\xampp\htdocs
</VirtualHost>


<VirtualHost *:80>
DocumentRoot E:\Programs\xampp\htdocs\CVCMS
ServerName cvcms.dev

<Directory "E:\Programs\xampp\htdocs\CVCMS">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

And here is my hosts file

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
#   ::1             localhost
127.0.0.1   lmlicenses.wip4.adobe.com
127.0.0.1   lm.licenses.adobe.com
127.0.0.1   cvcms.dev

I have restarted apache after every change, i have made sure http.conf is linked to the httpd-vhosts file.

The issue is when i type in the domain cvcms.dev it shows the xampp splash page instead of the index.php in my cvcms folder.

Any ideas why?

Thanks

1

1 Answers

3
votes

please remember to add the quotes to your virtual host document root path. At the same time what you need to to do enable them is to find httpd.conf , in this version it should be in your etc folder within your XAMPP's root folder.

Look out for :

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

Since '#' is a comment prefix, you have to uncomment "#Include etc/extra/httpd-vhosts.conf" See if this works. Remember to restart your XAMPP's apache server to read the new settings you've just set. Cheers !

You can read more on this here.