Https website physical path points to subfolder - iis-7

I think I somehow messed up my configuration and now it is not working as I would like to.
The situation is as follows:
I have two different web applications hosted under c:\web\site1 and c:\web\site2. I have setup then in IIS as two separate websites where the physical path is set to the locations above.
Site1 is bound to http port 80 and it works great to access it as http:// mydomain/site1.
Site2 however, should use https and port 443 (SSl cert etc is working properly). I would like this to be accessible from https:// mydomain/site2. The problem is that this gives me an IIS 404 page where it is indicated that I tried to access the physical path C:/web/site2/site2!
How can I solve this? It seems that https:// mydomain/ maps to physical path C:/web/site2 for some reason. I just want this to work in the same way as for site1 above.
Any help greatly appreciated!

If your 1st site in IIS has a path set to "c:\web\site1" and is bound to port 80, then...
The url http://mydomain will map to "c:\web\site1"
http://mydomain/site1 will map to "c:\web\site1\site1"
Same for the 2nd IIS site. If the site's path is set to "c:\web\site2" and is bound to port 443, then...
https://mydomain maps to "c:\web\site2"
https://mydomain/site2 maps to "c:\web\site2\site2"
If you want http://mydomain/site1 to map to "c:\web\site1", then you have 2 options...
Change your IIS site's path to just "c:\web"
Or add a virtual directory called "site1" under the root of the IIS site and point that to "c:\web\site1"

Related

How do I give access to another computer on my network, to my website hosted locally?

We have a local instance of IIS 7 running with a website. Instead of the default "localhost" we have something like, mysite.compname.com. This is a separate entry into IIS 7 and the default website was removed to prevent confusion.
Then in our host file we an entry like this:
127.0.0.1 mysite.compname.com
Now when I try to hit this url, http://127.0.0.1/ApplicationName/Project/AddProject.aspx technically it should work, but instead I get a 404. I can vouch that this isn't a problem with the application, because if I navigate to http://mysite.compname.com/ApplicationName/Project/AddProject.aspx it works fine.
My end goal is to be able to give someone my computer name, so that they can visit a test page, so the url above I think would get turned into this http://computername/ApplicationName/Project/AddProject.aspx. Any help or at least links to understanding would help because I'm not sure where my issue is coming from.
It sounds like the IIS site / application is configured using a Host Header.
This means that the site will only respond if the host header sent by the browser matches the one configured for the site.
This is a standard method to allow one server to host sites for many host and domain names.
If you wish to allow others to view the site on your computer you will need to either have a local DNS server which you can edit, or, probably the easiest option, get them to edit their host files to include
<your IP> mysite.compname.com.
Remember to open the requisite ports (probably only 80, maybe 443 for https) in your firewall.
Or, you can try to edit the site config to remove or modify the Host Header requirement. See the first link for details, but be careful, it's easy to break things if you don't know the entire architecture of the site.

Different output for http and www versions

I have a domain ie: foo.com
when i type http://foo.com , it goes to my app.
When i type www.foo.com it goes to default IIS page.
I am using plesk 9 for windows.
When i use nslookup to look up DNS they both point to same DNS.
In the IIS application go to bindings, and make sure BOTH www.yourdomain.tld as well as yourdomain.tld are binded. (PS. This question might have been better off at serverfault.com)
If the two domains points to the same IP address, it seems you need to properly configure the Host Headers of your IIS server.
Using Plesk, i think you just have to add a proper alias in the domain management page.
Changes which made in domain's configuration directly in IIS(not via Plesk) will be reset in future(after domain configuration update in Plesk)
In Plesk 9 you can switch on 'www' for domain on Hosting settings page, there is check box "WWW prefix" from left of domain name.

IIS7 - How do I use the same physical path for different domains?

I have two domains:
principal.com
copy.com
When someone type copy.com I want the user to see principal.com contents but whithout redirecting him to that domain.
Also if I create a subdomain such as sub.copy.com it will show the content from principal.com. Again, without redirect the user to that domain.
I tried configurating the DNS of copy.com to point to the same IP address of principal.com But I don't know how to configure this domain in IIS7 for use the same physical path as principal.com or If I need to do some other task...
I have done this with apache and the vhost files. Pointing multiple domains to the same DocumentRoot and configurating the DNS to use the same IP ADDRESS... But with IIS7 I don't know how to do it...
How Can I achieve what I want?
If you add multiple host headers to the web site (one for each domain), IIS should be able to serve up the same content for both requests.
To do this, click on the site in IIS, in the right hand panel ("Actions"), click on "Bindings..." and there you should be able to enter the different host names.

DNS and Subdomain IIS

I have 2 web apps installed on my IIS, one running as app1.mydomain and other one as app2.mydomain
In the test environment I just copied about two entries pointed to 127.0.0.1
What changes do I have to do in order to put this on production server, I mean on DNS level?
Can I use URL re-write on IIS to avoid changes for DNS?
Thanks
You need to add A or CNAME records mapping both subdomains to the external IP address of your server.
This tells web browsers to go to your server when you go to the subdomain; URL rewriting has nothing to do with this.

How to set up subdomains on IIS 7

I have a website sitting on an IIS 7 server:
WWW.example.COM
I would like to create several sub domains that looks like
SUBDOMAIN1.example.COM
I created an IIS website and I set the bindings to be
http, port 80, the ip address of my server, and SUBDOMAIN1.example.COM and the physical path to a folder under example.COM
I restarted my website and clicked on browse, the browser than opened with the address:
http://SUBDOMAIN1.example.COM
But the website doesn't show up.
Do I have to do something with the DNS?
This one drove me crazy... basically you need two things:
1) Make sure your DNS is setup to point to your subdomain. This means to make sure you have an A Record in the DNS for your subdomain and point to the same IP.
2) You must add an additional website in IIS 7 named subdomain.example.com
Sites > Add Website
Site Name: subdomain.example.com
Physical Path: select the subdomain directory
Binding: same ip as example.com
Host name: subdomain.example.com
Wildcard method: Add the following entry into your DNS server and change the domain and IP address accordingly.
*.example.com IN A 1.2.3.4
http://www.webmasterworld.com/microsoft_asp_net/3194877.htm
If your computer can't find the IP address associated with SUBDOMAIN1.example.COM, it will not find the site.
You need to either change your hosts file (so you can at least test things - this will be a local change, only available to yourself), or update DNS so the name will resolve correctly (so the rest of the world can see it).
As DotNetMensch said but you DO NOT need to add another site in IIS as this can also cause further problems and make things more complicated because you then have a website within a website so the file paths, masterpage paths and web.config paths may need changing. You just need to edit teh bindings of the existing site and add the new subdomain there.
So:
Add sub-domain to DNS records. My host (RackSpace) uses a web portal to do this so you just log in and go to Network->Domains(DNS)->Actions->Create Zone, and enter your subdomain as mysubdomain.domain.com etc, leave the other settings as default
Go to your domain in IIS, right-click->Edit Bindings->Add, and add your new subdomain leaving everything else the same e.g. mysubdomain.domain.com
You may need to wait 5-10 mins for the DNS records to update but that's all you need.

Resources