create virtual host example.local in xampp

43 views
no comments
21 May 2018 6:56 pm

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 httd.conf in xampp

Open #xampp click on Apache’s config button and click on httpd.conf

Open apache httd.conf in xampp

Open apache httd.conf in xampp

Write the following code at the end of file.

<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 and add the following line at the end of file and save it.

Setup it on hosts file

Setup it on hosts file

127.0.0.1 sdtuts.local

and finally access it with local address http://sdtuts.local/

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>