繁体   English   中英

在web.config中插入URL重写规则后出现错误404?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM