- Installation of XAMPP
To get your local development started and use url's in your browser to point to
locally installed webprojects you need to first add a line to your hosts
file
On Windows this should be located at the following path.
C:\Windows\System32\drivers\etc\
Open this file in Notepad. It is possible you need to run Notepad as Administrator to be able to save this file after your changes.
Add a line pointing to the default "my computer" ip address 127.0.0.1
127.0.0.1 clientname.local
Add extra lines if you need extra virtual hosts. Use .local or.dev to differentiate with the normal internet tlds.
After you have changed to hosts
file you will need to change an Apache config
file called httpd-vhosts.conf
For XAMPP this is located at
<path to xampp directory>/apache\conf\extra\httpd-vhosts.conf
Again open this file in Notepad, run as administrator if needed.
Add the following lines at the bottom
NameVirtualHost *
<VirtualHost *>
DocumentRoot "<path to xampp directory>/htdocs"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "<path to local dev environment>/clientname"
ServerName clientname.local
ErrorLog "logs/clientname.local-error.log"
CustomLog "logs/clientsname.local-access.log" common
<Directory "<path to local dev environment>/clientname">
Order allow,deny
Allow from all
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
Adjust accordingly to your installation of course. The first virtualhost is needed to get phpmyadmin installed together with XAMPP to still work.
In the VirtualHost Directory section you will notice a AllowOverride All
portion.
This allows .htaccess
files to actually work. Without this option url rewriting
for instance will not work.
Other virtualhosts can be located anywhere on your computer.