How to Add Virtual Directory Alias on Apache Xampp.

Do you want to create some alias or you can call it virtual directory on Apache Xampp?

Why do you need an alias or virtual directory?

Supposed you have installed Xampp on some directories, like:
C:\xampp\
 
And the default document root would be in:
C:\xampp\htdocs
 
But, my source code are all outside that htdocs directory, example:
D:\myproject
 

So, you need to add an alias or virtual directory in my Apache web server.

Open the httpd.conf file, it’s located in this directory:
  •  C:\xampp\apache\conf
  •  Add these lines on the bottom of the httpd.conf file: 
  •  Alias /myproject "C:/path/to/my/project"
    <Directory "C:/path/to/my/project">
      Options Indexes FollowSymLinks MultiViews ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory> 
  • Restart your Xampp
  • Open your web browser and test it by go to http://localhost/myproject

Comments