create virtual host example.local in xampp

0.42K views
no comments
26 Apr 2019 2:37 am

By default Each of project located in www htdocs folder directory are accessed by http://localhost/projectname so we want to change it http://projectname.local or whatever local domain you want, I have my site project http://localhost/sdtuts and I want to access it as http://sdtuts.local/.

Open apache httpd-vhosts.conf

Go you installed xampp_directory/apache\conf\extra\ open file httpd-vhosts.conf make it empty and add following code in

<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
 
 
<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/sdtuts"
    ServerName sdtuts.local
    <Directory "D:/xampp/htdocs/sdtuts">
        Require all granted 
    </Directory>
</VirtualHost>

Setup it on hosts file

To to C:\Windows\System32\drivers\etc and open “host” file with notepad++ or another editor tool

add the following line at the end of file and save it.

127.0.0.1 sdtuts.local

Restart Apache Service

Go to your xampp panel and stop and start apache service.

finally access it with local address http://sdtuts.local/ from browser.

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>