This question could be posted on ServerFault as well, however 开发者_运维技巧there is definitely a coding element involved due to the rewrite rules in my web.config. This is why the question does indeed have a home on SO.
I've recently deployed a website to a new server and have discovered that trying to access my site via www.example.com
returns a 404 while example.com
works just fine. I'm not sure if this is an IIS configuration issue or with the rewrite rules I've specified in my web.config
.
I have not redployed the site without the rules shown below to see if they are indeed the issue. These rules were working fine while the site was hosted by DiscountASP.NET.
<rewrite>
<rules>
<rule name="Redirect to NON-WWW" stopProcessing="true">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="^www.rsolberg.com$"/>
</conditions>
<action type="Redirect" url="http://rsolberg.com/{R:0}" redirectType="Permanent"/>
</rule>
<rule name="Default Document" stopProcessing="true">
<match url="(.*)default.aspx"/>
<action type="Redirect" url="{R:1}" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
I've also confirmed with GoDaddy that there is a WWW cname
pointed to @.
Working:
http://rsolberg.comNot Working:
http://www.rsolberg.comI would confirm that IIS has both host headers (rsolberg.com and www.rsolbeg.com) listed for your site. Without the www version requests will make it to the correct web server but IIS won't serve the correct site and may be returning a generic 404 instead. I don't think the redirect/rewrite is involved at all as no 301/302s are getting sent.
I have solved this problem earlier, just delete the earlier CNAME. And try adding a new one as below
www.rsolberg.com CNAME --> rsolberg.com
- Ananth Ramasamy Meenachi www.msarm.com
精彩评论