Creating XAMPP Alias Directories
If you’ve read my post on adding aliases to WampServer, you may be curious about how to add aliases to XAMPP. While WampServer has a tool for adding Apache aliases, XAMPP does not. Fortunately, creating XAMPP alias directories by hand is pretty easy.
Preparing to Create XAMPP Alias Directories
The first thing you’ll want to do is add an alias directory to your XAMPP install. If you’re running Windows, create the following folder.
1
|
|
Next, you’ll need to change your Apache configuration file.
You can find it under C:\xampp\apache\conf\httpd.conf
.
To make changes, you’ll need to edit it as an administrator.
If you’re running Windows Vista or above, your best bet is to open Notepad as an administrator and then open httpd.conf.
To open Notepad (or any other application) as an administrator, right-click on it and select “Run as administrator”.
You can also launch Notepad as an administrator from the start menu with Ctrl+Shift+Enter
while Notepad is selected.
Once you’ve opened httpd.conf, add the following to the end and save it.
1
|
|
Now Apache will look in the alias folder for more configuration files. This way you can add an alias by simply adding a new configuration file to the conf/alias/ folder.
Creating XAMPP Alias Directories
Let’s add some XAMPP alias directories.
Suppose you want to add an alias called “dev”.
First, download this alias template file and place it in the alias folder.
Rename it to “dev.conf” (or whatever you want to call your alias).
You’ll need to edit the template and replace {DIRECTORY}
(it’s at the beginning of the file and at the end) with the folder path, and replace {ALIAS}
with the name of your alias.
In our example, it looks something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Restart Apache (you can do so from the XAMPP control panel) and check out http://localhost/dev. You can repeat this process with other aliases to add more XAMPP alias directories.