0

Our company hosts our own website on a leased server (windows 2012 R2) To access it, we can use the IP (http://159.68.xxx.xxx) or the domain name we purchased (www.example1.com), which is simply a redirect to our IP.

We would like to host another website on our server, it is currently in a virtual directory and can easily be accessed using the following url : http://159.68.xxx.xxx/example2 We also purchased another domain name for that website (www.example2.com)

My question is: how can I access the new website via it's domain name? This works: http://159.68.xxx.xxx/example2 but we want this to work as well : http://www.example2.com

Many thanks.

6
  • 1
    You can configure multiple domain names in IIS, each with its own root directory.
    – RalfFriedl
    Sep 14, 2018 at 16:35
  • How do you achieve that?
    – Mike H
    Sep 14, 2018 at 16:47
  • First hit when searching google for "multiple domain names in IIS": help.sana-commerce.com/sana-commerce-83/configuration/…
    – Tommiie
    Sep 14, 2018 at 16:50
  • Ok, I have now two different sites in IIS. One is binded to www.example1.com, the other is binded to www.example2.com. Only the example1.com works. How can the dns resolve www.example2.com?
    – Mike H
    Sep 14, 2018 at 17:14
  • By creating a DNS record for www.example2.com.
    – joeqwerty
    Sep 14, 2018 at 18:20

1 Answer 1

2

You can run multiple websites off a single IP in IIS, but you'll need to setup a separate IIS Site. It will not work as a virtual directory in your first site and correctly resolve via the second FQDN.

If you are leasing this server and only have access to your website via a control panel you will most likely not be able to do this and will need to purchase another IIS site from your vendor.

You didn't specify what access you have to the server, but if you have access (and permissions) to modify IIS then you would do the following:

Edit existing site bindings

  1. Open IIS Manager
  2. On the left hand side expand the Server node and the Sites Node
  3. Select your site
  4. Click on Bindings on the far right int he Actions section
  5. Select each binding and edit them one at a time
  6. Enter the FQDN for your first site (if this is not already specified) in the Host Name field
  7. Click close when finished

Create a new Application Pool for your new site

  1. On the left hand side select Application Pools
  2. Right click on Application Pools
  3. Select Add Application Pool
  4. Enter the name of your new website
  5. Click OK

Create the new website

  1. On the left hand side select Sites
  2. Right click on Sites
  3. Select Add Website
  4. Enter the site name
  5. Select the Application Pool by clicking Select and choosing the new Application Pool you created in the previous step
  6. Enter the Physical Path to your website files
  7. Select the IP address (the one you already have) for the Binding
  8. Enter the host name in Host name field
  9. Click OK

If you have Powershell access and would like to do it that way use the following:

Get-WebBinding -IPAddress 159.68.0.0 -Port 80 | Set-WebBinding -HostHeader www.example1.com
New-WebAppPool -Name MySite
New-Website -Name MySite -Port 80 -IPAddress 159.68.0.0 -HostHeader www.example2.com -PhysicalPath D:\Websites\www.example2.com -ApplicationPool MySite

You might be able to achieve your initial goal with URLRewrite, but it won't always work and would depend on how complicated your second website is. I wouldn't recommend this method and would do the previous steps I outlined.

2
  • Thank you very much Tim. I followed your instructions and then all I had to do was add an A record to the DNS config of my domain name provider and voila... All good, Thank you.
    – Mike H
    Sep 18, 2018 at 14:24
  • can both the site (with different domain name) point to same app pool?
    – wenn32
    May 1, 2020 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.