Tutorial :Is it possible to simulate subdomain on a development machine?



Question:

I am trying to set up a subdomain on my website but i am having a hard time getting it to work. Especially since the only way i can test it is by sending all the files needed from my development machine to the hosting server (and sometimes breaking the website). i am using asp.net on an IIS7 servers

Is there an easy way to do the setting on the development machine?


Solution:1

One thing you can do is to edit your "<windows directory>\system32\drivers\etc\hosts" file, and point the domain name to 127.0.0.1.

Do this by adding a line at the bottom of the file:

127.0.0.1    subdomain.testdomain.com  

The question was about ASP.NET and IIS, so I assumed Windows, but just in case anybody reads this that wants to know the Linux equivalent, you'll want to edit the file "/etc/hosts", and add a line of the same format.

Very important note: If you redirect the real domain name to your local machine like this, don't forget that you did it, or it'll drive you nuts later when you can't figure out why the changes you uploaded to the live site aren't doing anything. Not that I know from experience or anything.


Solution:2

what did you mean by simulate? You can easily add a subdomain in your host file

\system32\drivers\etc\hosts

Just make sure that you have a dns entry for this new domain. So contact whoever is incharge of creating them.

Hope this helps.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »