Setting Subdomains in Your Localhost Using XAMPP

Here is a quick guide on how to create multiple subdomain in your localhost using XAMPP

Step 1

Open your XAMPP control panel and click explore. This will take you to your XAMPP installation directory.

Now go to Apache > Conf > Extra then locate and open ‘httpd-vhosts.conf’file.

NOTE: Create a backup of the file before editing.

In httpd.xampp.conf file add this line for subdomain support :

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

Step 2

Go to C:\WINDOWS\system32\drivers\etc -> “hosts” file and add: subdomain.localhost

Step 3

Now, go back to your XAMPP control panel and restart apache by clicking the designated stop button then afterwards the start button.

Go to your browser and type in the address bar :

That should be working perfectly 🙂

Happy coding! 😀