How to create subdomain on localhost

Some time we need to create subdomain on our localhost or local server. I have also faced this problem so that I am going to share with you that how to create subdomain on localhost. Creating subdomain on your local server is very easy.

Creating subdomain on XAMP or Local Server

If you want to create subdomain on xamp then follow the following instruction.

  • Find the following file on your system


  • Add the following code at the end of the file

# Custom Server and hosts

  • Now find the following file and open that


  • Add the following code at the end of this file

  • Now restart your server. You can access your subdomain like