這個問題也可以發佈在ServerFault上,但是由於我的web.config中的重寫規則,肯定會涉及到一個編碼元素。這就是爲什麼這個問題確實在SO上有一個家。www.example.com不起作用,但example.com確實
我最近部署了一個網站到一個新的服務器,並發現嘗試訪問我的網站通過www.example.com
返回404而example.com
工作得很好。我不確定這是IIS配置問題還是我在web.config
中指定的重寫規則。
我沒有重新部署網站,沒有下面顯示的規則,看看他們是否確實是問題。這些規則在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>
我也與GoDaddy證實,有一個WWW cname
指出@。
不工作:上市
http://www.rsolberg.com
是您的服務器監聽'WWW .rsolberg.com'?如果沒有,那麼你的重定向將不會發生,因爲服務器將永遠不會看到'www.' – Seth 2010-02-12 17:28:24
@Seth的請求:我猜我輸入了'rsolberg.com'而沒有www .... – RSolberg 2010-02-12 17:35:33