简体   繁体   中英

Error 404 after inserting URL rewrite rule in web.config?

I want to redirect all url with uppercase to it lowercase version. For example:

https://www.droidafrica.net/Phone/Tecno-Spark-2-Go-Edition/ to
https://www.droidafrica.net/phone/tecno-spark-2-go-edition/

I put the code below in web.config. It worked after applying changes, but most of the featured image thumbnails for devices specs gave error 404. Am I missing anything?

(I've temporarily removed the code though).

<rewrite>
        <rules>
            <rule name="LowerCaseRule" stopProcessing="true">
            <match url="[A-Z]" ignoreCase="false" />
            <action type="Redirect" url="{ToLower:{URL}}" />
            </rule>
        </rules>
    </rewrite>

Still wondering why I was getting error 404.

This is the code that work for me without adding further conditions; if you look closely, it a bit different from the first.

<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>

All thanks to RuslanY Blog .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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