Steps to create custom URL to work locally:
If you had installed xampp in D:/ folder then follow following steps, if you have installed in C:/ or other folder then replace D with respective folder name.
- Open up the Xampp control panel and stop Apache (Ensure that you don’t have it running as a service.
- Navigate to D:/xampp/apache/conf/extra or wherever you installed Xampp
- Open up your text editor with administrative privileges and open up httpd-vhosts.conf found in the D:/xampp/apache/conf/extra folder
- At the very bottom of the file paste the following (check if it exists there already)
<VirtualHost *:80> DocumentRoot "D:/xampp/htdocs" ServerName localhost </VirtualHost>
- Without that line of code you will lose access to your default htdocs/ For eg: http://localhost/ will be inaccessible.
- Now copy and paste the code below:
<VirtualHost *:80> DocumentRoot "D:/xampp/htdocs/webocreation" ServerName webocreation.dev ServerAlias www.webocreation.dev <Directory "D:/xampp/htdocs/webocreation"> AllowOverride All Require all Granted </Directory> </VirtualHost>
- Now we head over to our Windows Hosts File, to edit the HOSTS. File will be located at C:/Windows/System32/drivers/etc/hosts, where hosts is the file.
- look for the line above, and enter your site mimicking the layout
127.0.0.1 localhost 127.0.0.1 webocreation.dev
- Change this to the domain name you choose earlier
- Change it to reflect the lines above (if you have problems saving it meant you didn’t have your text editor running in admin mode.
- Restart Apache and test to make sure it is working.
- Go to the URL