How to add rewrite rules to web.config?

Topics: Business Logic Layer, Controls
Feb 22, 2013 at 6:21 AM
Hi All,

I am trying to prevent urls coming in with different cases to be 301 redirected to an all lower case url.

Wanted to fix this problem mention below:

_"According to RFC3986, the path portion of a URI is case-sensitive.

Google and other search engines use this ruling in their crawlers, so that pages which differ by case are treated as different pages."_


Source:
http://www.craigwardman.com/blog/index.php/2009/03/preventing-uppercase-urls-in-asp-net/

I know BE uses a HTTP module to rewrite URLs.

Is there a way to put this in the web.config file:

<rule name="Convert to lowercase" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />  
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>

Everytime I try to put it in there I get an 500 error.

I put it with in the

<system.web> section.

Is that the correct location?

If can not put it in the web.config file what is the equivalent code to put in the rewrite module to
have this same effect as the url rewrite rules?

Thanks,

Brian Davis