Change/Add virtualhost name like localhost
Follow the steps below to add/change the virtualhost name:
For Windows
- Go to your xampp folder: C:\xampp\apache\conf\extra
- Find httpd-vhosts.conf and open it with any of text editor like notepad
- Stop Xampp if running.
- Add these line first:
- NameVirtualHost *:80
- <VirtualHost *:80>
- DocumentRoot "C:/xampp/htdocs"
- ServerName localhost
- </VirtualHost>
- Then:
- <VirtualHost *:80>
- DocumentRoot "C:/xampp/htdocs/your/website/folder"
- ServerName yourdesiredname.you
- ServerAlias www.yourdesiredname.you
- <Directory "C:/xampp/htdocs/your/website/folder">
- AllowOverride All
- Require all Granted
- </Directory>
- </VirtualHost>
- Save the file
- Now go to : C:\Windows\System32\drivers\etc
- Find for hosts
- make a back up of this file to anywhere on your system
- Now open the file with any of text editor like notepad
- Add these lines to the end of the file:
- 127.0.0.1 localhost
- 127.0.0.1 www.yourdesiredname.you
- Save the file
- Restart the xampp
- write your chosen domain name i. e. : www.yourdesiredname.you into your browser and you are done