Selasa, 23 September 2014

Virtual Hosts Using XAMPP (Setting Virtual Host Pada XAMPP)



How to Edit Your Computers Hosts File
To edit the hosts file in a notepad editor do:
  • Click Start then enter cmd in the search box.
  • Right-click the cmd program and select Run as administrator
  • In the command prompt that shows enter the following 2 commands
copy C:\Windows\System32\drivers\etc\hosts C:\Windows\Temp
notepad C:\Windows\System32\drivers\etc\hosts
  • The first of these two commands is just to make a copy of the hosts file, so that you can restore it later if you want to.
  • The second command opens the hosts file in Notepad so you can edit it. Normally you can remove all lines in that file that doesn't start with a #, except if the line says: 127.0.0.1 localhost
  • Save the hosts file

How To Set Up Virtual Hosts Using XAMPP

Navigate to C:/xampp/apache/conf/extra/httpd-vhosts.conf

 

  1. At the very bottom of the file paste the following

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>

 

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/project/public"
ServerName www.website.com
</VirtualHost>

Now we head over to our Windows Hosts File, to edit the HOSTS. the file will be located at C:/Windows/System32/drivers/etc/hosts, where hosts is the file.

127.0.0.1             localhost
127.0.0.1             www.website.com

Restart Apache and test to make sure it is working

Tidak ada komentar:

Posting Komentar