Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The Apache web server supports the concept of aliases. An alias is a virtual directory that points to a location on disk and you can address the alias through the web browser and retrieve documents from the disk in this manner. The directories that you set up as aliases don't need to be under the document root folder. You can make them independent on your disk. To demonstrate this I've created a folder under my CDrive root named mywebapp and I've created a simple file called index.php under it.
I'll open the file in Notepad and show you that it executes a simple PHP command, php.info, which outputs the current PHP configuration to the screen. Now this directory is not under my WAMP folder, that's the document root, and I want to make the entire directory accessible through the browser. So I'll go to the WampServer administrative menu and choose Apache > Alias directories > Add an alias. That opens up a command-line window. I'll type in the name of the alias that I want to create.
It's going to appear to the browser as a directory under the localhost or 127.0.0.1 root. I'll name my alias webapp, then I'm asked to type in the full location of the physical directory, using forward slashes. I'll type c:/mywebapp/ and press Enter. That creates the alias. Next, I'll go to the WampServer administrative menu and I'll make sure that the Apache web server is restarted by checking the color of the gauge.
If it's not white, just open up the menu and choose Restart All Services. Once the gauge shows you that all the services have restarted, you can go to a browser and test the new alias. I'll type in http://localhost/webapp/ index.php and if the alias is working correctly, I should see the output of the PHP info command, showing me my PHP configuration.
If you don't see this display, if for example you see the actual PHP code or you're prompted to download the PHP file to your hard disk, that means Apache didn't successfully restart. You should stop Apache completely and then restart and if all else fails reboot your computer to continue onward. You can add as many aliases to your Apache configuration as you like. The advantage of an alias is that the folder containing your web files is outside the WAMP document root and therefore outside the WAMP installation root folder.
You can manage your files much more easily, but you can also add whatever PHP files, HTML files, image files, and other web assets you need to construct your web site.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98327 Viewers
61 Video lessons · 85625 Viewers
71 Video lessons · 69566 Viewers
56 Video lessons · 101898 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.