问题
I am having a problem with my Umbraco installation on IIS. The site is working, apart from my home button. When I push the home button, the URL should be
http:/myserver.mysite
instead the URL is
http:/myserver
When I type in the link it serves me the home page but when I click on the Home button it wont and the scenario described above occurs.
I am using IIS 7 and Umbraco 6.1.1.
回答1:
If you are able to get to the homepage with both hostnames but then clicking on the Home link takes you to the second host, the link in the page must be referencing the hostname directly. If this is the case, check your HTML to ensure that the hostname isn't present in the link - basic I know but you have to check.
If it isn't, contrary to what Eric Herlitz says in his answer, I would ensure that you don't have anything set in the hostnames options. I only use the hostnames option when I need to control the hostnames of multiple root nodes. Umbraco will automatically assume that the first node in the tree is the default site. In other words, if you have two sites at the root of your Umbraco instance but only one hostname bound in IIS, Umbraco will serve the first of the branches as the default site, unless as Eric Herlitz states, you have specified the hostnames for specific nodes.
Instead, I would use the settings in IIS to ensure that requests are routed to the correct hostname. I know using Eric's approach is possibly easier, but it would undoubtedly mean that users will still be able to reach and browse the site using both hostnames. Ultimately from an SEO perspective this is a bad thing. Personally, I would ensure that any requests to anything but your preferred hostname are redirected to you hostname whilst retaining the path. This can be done via IIS using the UrlRewrite 2 module.
If you don't have access to this, you can use MVC routing (see here for an explanation) or the UrlRewriting module that comes shipped with Umbraco. With the latter, settings are specified in the ~/config/UrlRewriting.config file and documentation can be found here: http://www.urlrewriting.net/149/en/home.html
I would personally recommend familiarising yourself with all these techniques as they can be quite powerful.
回答2:
Did you set your hostname in Umbraco?
Right click on the site root in your solution and click "Culture and hostnames"
Fill out your hostnames and save
来源:https://stackoverflow.com/questions/17390498/umbraco-configured-with-iis-7-having-hard-time-with-the-site-url