Web Programming

Treating a Subdirectory Like a Web Root Directory in XAMPP


You have created a website called zabath, and able to access the website by going to http://localhost/zabath.

So, You would like to set it up so that you can point local browser to say, http://zabath, and have it treat the foobar directory like the web root directory.



To get your browser to look for http://zabath on your local machine you’ll have to add this line to your host file zabath

Then add a virtual host in your Apache http.conf file,

<VirtualHost *:80>
    DocumentRoot path/to/zabath
    ServerName zabath

You may also have to add another virtual host

<VirtualHost *:80>
    DocumentRoot path/to
    ServerName localhost
ServerAlias 127.0.0.*

Source: superuser.com

Leave a Reply