How to Configure Virtual Host in XAMPP

How to Configure Virtual Host in XAMPP

Today, We want to share with you How to Configure Virtual Host in XAMPP.
In this post we will show you Setting up Virtual Hosts WordPress Windows 7 with XAMPP, hear for xampp virtual host windows 10 we will give you demo and example for implement.
In this post, we will learn about How to add a Virtual Host in XAMPP with an example.

Virtual hosting is a most IMP method for other running hosting multiple domain names created (with separate run mode handling of each name) on a single server used. This allows one server and then to share its all resources, such as memory default and processor cycles running mode, without requiring all any services provided to simple used to the same host name in local.

Step 1 : virtual host

C:\WINDOWS\system32\drivers\etc\
Open the “hosts” file

Also Read :  PHP Codeigniter load data while Ajax Infinite scrolling Pagination

127.0.0.1       localhost
127.0.0.1       Pakainfo.com
127.0.0.1       Pakainfo.com
127.0.0.1       yourdomainname

Step 2 : setting on virtual host

xampp\apache\conf\extra\httpd-vhosts.confhttpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot C:/xampp/htdocs/pakainfo.com/
    ServerName www.Pakainfo.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot C:/xampp/htdocs/pakainfo.com/
    ServerName www.Pakainfo.com
</VirtualHost>

Step 3 virtual host in xampp

height=”220″ class=”size-full wp-image-1937″ /> Setting of Virtual Hosts on XAMPP[/caption]

Restart XAMPP and now run in your browser and then run in your browser:

www.Pakainfo.com 
//or
www.Pakainfo.com

Other ways to Step By Step setting up to virtual host

  • You need to generally have XAMPP installed in your system
  • and then Open up the Xampp server control panel and stop the Apache.
  • now call the open to Navigate to this path
    C:/xampp/apache/conf/extra or wherever(Like as a xampp,wampp,etc..) we installed xampp server.
  • Fire up simple your text editor Like as a(Notpad++) with administrative privileges config and open up httpd-vhosts.conf file or search found in the path C:/xampp/apache/conf/extra open folder
  • At the very bottom in your file source code of the file paste the following this code and changes
Also Read :  codeigniter Controller pass parameter route Function

NameVirtualHost *:80

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

With out that find the line of source code you will lose access to your simple ip 127.0.0.1 as a default htdocs directory. IE. and run this http://localhost/ will be inaccessible.

Now copy this code and paste the code below here
.. below the simple first code….

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/pakainfo.com"
ServerName pakainfo.com.dev
ServerAlias www.pakainfo.com.dev
<Directory "c:/xampp/htdocs/pakainfo.com">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

imp Noew : For Persons using the latest version of Apache used to (at time of this update 2.4 +) use the source code below as the above code copy and post is for Apache versions below 2.4

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/pakainfo.com"
ServerName pakainfo.com.dev
ServerAlias www.pakainfo.com.dev
<Directory "c:/xampp/htdocs/pakainfo.com">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>

Now we head over to our simple Windows Hosts File setting are done, to edit the HOSTS here file location. the file will be located at C:/Windows/System32/drivers/etc/hosts, where hosts file is open in your notepadd is the file.

Also Read :  Difference Between Echo and Print Statements in PHP

127.0.0.1             localhost

127.0.0.1             localhost
127.0.0.1             www.pakainfo.com.dev
127.0.0.1             www.example.dev
127.0.0.1             demo.pakainfo.com.dev
127.0.0.1             www.pakainfo.com.dev 

Last step of the Restart Apache xampp server and test to make sure virtual host is working.

We hope you get an idea about Configure Virtual Host with XAMPP Running on Windows 10
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Leave a Reply

Your email address will not be published. Required fields are marked *