[英]Error 404 after inserting URL rewrite rule in web.config?
我想將所有帶有大寫字母的網址重定向到小寫版本。 例如:
https://www.droidafrica.net/Phone/Tecno-Spark-2-Go-Edition/
https://www.droidafrica.net/phone/tecno-spark-2-go-edition/
我將代碼放在web.config中。 應用更改后它可以工作,但是設備規格的大多數特色圖像縮略圖都出現了錯誤404。我有什么遺漏嗎?
(不過,我暫時刪除了代碼)。
<rewrite>
<rules>
<rule name="LowerCaseRule" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
</rules>
</rewrite>
仍然想知道為什么我會收到錯誤404。
這是對我有用的代碼,無需添加更多條件。 如果仔細觀察,它與第一個有一點不同。
<rewrite>
<rules>
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
感謝RuslanY Blog 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.