[英]Canonical Rewrite for subpages not working by using rewrite rules in web.config
我們在Azure上托管了一個簡單的HTML asp.net網站,當我們在瀏覽器中復制粘貼子頁面URL(無WWW)時,我們面臨重定向問題。 示例:www.example.com/subpage.aspx可以正常工作,但是在復制粘貼example.com/subpage.aspx時,它會重定向到www.example.comsubpage.aspx /(坦率地說,不知道它在哪里以及如何發生)
實時將以下代碼寫入web.config文件中(確切的域名除外)
<rewrite>
<rules>
<rule name="RedirectToWWW" stopProcessing="false">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example\.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{R:0}" />
</rule>
</rules>
</rewrite>
這是該項目的新手,因此有關我應該在哪里開始調查或應該在哪里進行修復的任何指導都將非常有幫助。
改成:
<action type="Redirect" url="http://www.eyeswidewhat.net/{R:1}" />
另外,將stopProccessing
設置為true
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.