How can I set up a VirtualHost on my local developer environment? Ideally I would also like to be able to access my site from a simply URL, such as www.joomla.loc rather than having to constantly use the localhost URL.
In this I will explain how to set this up for Wampserver 2.5 with Apache 2.4+.
Once you have downloaded, installed and started Wampserver, go to the following directory on your computer and created a new folder called "joomla"
Within your newly created folder, extract the Joomla zip file.
Now that you have your new folder with the Joomla installation in there, you now need to open the following file in a text editor, such as Notepadd++
In this file, add the following, which will map the localhost IP address to the defined URL:
Note that I have 2 instances, 1 with
Save the file, and then open the following file in your text editor
Add the following to the file above at the bottom:
The above code is only for Apache 2.4+ and will NOT work for Apache 2.2.
You've now created your VirtualHost for your newly created folder. All you need to do now is restart Apache, by clicking the green Wampserver on your taskbar, then clicking "Restart All Services" as shown in the screenshot below:
You can now type in
Hope this helps. Would be also nice if some people who are running other development environments such as Xampp, Lamp and Mamp could post an answer too
Instructions for Linux OS with Apache 2+ Server:
Now type in your browser's address bar:
I've just did this with OSX and here's how;
All websites on OSX are stored in
Create a new website folder called 'joomla'
Now add a new record to Apache's host file - edit
Add the following to the file (change names accordingly);
ServerName is the name you will type into your address bar to access your website.
DocumentRoot is where your website is located.
Now edit the
Add another record to point to the new website;
Lastly, restart Apache
You should now be able to go to
Worked for me.
Hopefully I haven't left anything out!