If you are looking for a quick and easy ways to create server aliases, WAMP server is your answer.
What is an Alias?
Let us assume that you are using the document root for main site, and you want to direct the server directories outside the document root. For example, you want to map following:
- Students -> C:students
- Teachers -> C:teachers
- Principal -> C:principal
WAMP server interface by default allows you to quickly set up aliases, but they might not work.
Adding Aliases from WAMP Interface
Left-click the system tray icon and then go to the Apache -> Alias Directories -> Add An Alias
A command prompt will open prompting you to create the alias URL
Type the names of the alias; this will be what is added onto the http://domain_name/address e.g. (http://www.webtamarin.com/students)
Enter the location of the folder that will house the pages for this website. keeping with our earlier example, type C:students and then hit Enter.
The alias will now set up according to WAMP.
Don’t panic if the alias doesn’t work.
When you create the alias using the WAMP server, it creates the necessary file in the correct location, but it adds all the content in one line
Alias /students/ “C:students” Options Indexes FollowSymLinux MultiViews AllowOverride all order allow, deny Allow from all
The file should look like
Alias /students "C:/students"
Options Indexes FollowSymLinks ExecCGI
Order Deny, Allow
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
To edit that file, follow these steps:
- Left-click the WAMP icon in the system tray.
- Go to Apache -> Alias Directories -> ALIAS_NAME -> Edit Alias (here ALIAS_NAME is the name of the alias you just created).
- In the Notepad window which just opened, edit the configuration file to reflect the above contents and save it.
- Edit the configuration file to best fit your needs (according to the Apache specifications).
Restart the WAMP server, and you should be able to point your browser to http://localhost/students. (Of course, you’ll need content within the C:students directory.) If you get an error, check to make sure the alias directory’s permissions allow the server to read the contents; this will be dictated by a number of issues, such as whether the server resides on a Windows domain.