In this tutorial, you will learn to create Apache alias directory in WampServer. Typically, if you do not create a alias directory, you need to place your php files in the www directory of WampServer to be able to execute them on a web broswer. The alias directory allows you to save your web page files in a directory of your choice rather than www directory and have a url point to that directory. For example, a url that points to the d:/mysite directory can be http://localhost/healthtips/. To accomplish this task, first you need to create mysite directory in drive D. You will place your web page files in the mysite directory. For this tutorial, you can create a PHP page called helloworld.php and save it in the mysite directory. It simply displays the Hello World message. Then on the task bar or in the Notification Area Icon, select WampServer icon ->Apache-> Alias Directories->Add an alias.
You will get a console window as shown below. You are asked to enter the alias for the url to point to mysite directory. Simply type healthtips for the alias.
By pressing Enter key, you will see another console window as shown below. In this window, you need to enter the full path of the mysite directory (d:/mysite/). After you press Enter key, the alias is created for you.
To test the alias, open your web browser and type the following url: http://localhost/healthtips/helloworld.php. The helloworld.php will be executed and the Hellow World text is displayed as shown in the image below.
Alternatively, you can create an alias directory by using the httpd.conf file of Apache (WampServer icon->Apache->httpd.conf). You need to append the following code to the httpd.conf file.
Alias /healthtips "D:/mysite/"
Options Indexes FollowSymLinks MultiViews
Allow from all
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: