Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup hostname to website in local IIS

I am using Windows 10 with IIS enabled.
I need to setup local websites on different ports with hostnames which I can access locally by using those hostnames.

For e.g.
Website Name: abcd website
Path to Directory: D:/Projects/Websites/abcd.com
Hostname: abcd.com
Port: 1001

Currently I can access the website with localhost:1001 or 127.0.0.1:1001 But I'm looking forward that my local websites should get resolved with hostnames. So, if I go to http://abcd.com/ it should take me to http://localhost:1001/

With this I wish to setup subdomains to some websites as well. I need help to achieve this.

like image 696
GB Patil Avatar asked Oct 05 '15 14:10

GB Patil


1 Answers

If you want to do this locally then modifying the HOSTS file of the server hosting your site to point to the local machine's IP when visiting the abcd.com domain should do it.

Modifying your hosts file allows you to override the DNS for a domain, on that particular machine. This is useful when you want to test your site without the test link, prior to going live with SSL; verify that an alias site works, prior to DNS changes; and for other DNS-related reasons. Modifying your hosts file causes your local machine only to look directly at the IP address specified.

  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search results, right-click Notepad and select Run as administrator.
  4. In Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
  5. Add the following entry to the file:

    Local IP Address    www.abcd.com
    

    Click File > Save to save your changes.

Source: http://www.rackspace.com/knowledge_center/article/modify-your-hosts-file

NOTE: If you want to do this from another computer you have admin rights on then you use the same approach. If you want to do this from another computer you do not have admin rights on then you should go about getting a dedicated DNS entry set up for this site

like image 54
ShaneC Avatar answered Nov 01 '22 20:11

ShaneC