DWQA QuestionsCategory: PHPHow to create Vhost in window for xampp?
asked 6 years ago

Step1: Go to below  path 

C:\xampp\apache\conf\extra

open file : httpd-vhosts.conf

Add :

<VirtualHost *:80>  

ServerName localhots.com  

DocumentRoot “acess_path(C:/xampp/htdocs/..)”  

<Directory “acess_path(C:/xampp/htdocs/..)”>  

Options FollowSymLinks  

AllowOverride All  

Order allow,deny  

Allow from all  

</Directory>

</VirtualHost>

Step2:  

Go to below path :

C:\Windows\System32\drivers\etc

open this file hosts:  

(prefer opne in notepad ++ to editable)

Entry your host name :

127.0.0.1      localhots.com

Step3 : 

Restart xampp or wamp 

Thanks 🙂    

1 Answers
kandy Staff answered 6 years ago

Step1 :

You need to have XAMPP installed ( 😐 )

Step2 :

Open up the Xampp control panel and stop Apache (Ensure that you don’t have it running as a service … this is where doing so complicates things)

Step3:

Navigate to C:/xampp/apache/conf/extra or wherever you installed xampp

Step4  :

Fire up your text editor with administrative privileges and 

Step5: 

Open up httpd-vhosts.conf found in the C:/xampp/apache/conf/extra folder

Step6: At the very bottom of the file paste the following

<VirtualHost *:80>
DocumentRoot “C:/xampp/htdocs/laravel/public”
ServerName localhost.dev
ServerAlias http://www.localhost.dev
<Directory “c:/xampp/htdocs/laravel/public”>
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>

Step6: Go to following path

 C:/Windows/System32/drivers/etc/hosts, where hosts is the file.
 open this file and add following code.
 127.0.0.1             localhost.dev

 
 Step7 :

 Restart Apache and test to make sure it is working