Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

Going crazy with trailing slash and double redirects

$
0
0

Hallo, I'm totally new to rewriting by the way I found I nice article with some tips I really find useful for common scenario redirects here:

http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx

Among the others the two I immediatly grabbed are the one to REMOVE trailing slash and the other one to enforce lower case.
The problem is that the slash always gets added instead of being removed. So if I callwww.mysite.com/admin I'm always redirected towww.mysite.com/admin/ 

But I'm looking for the opposite wich should be the "standard" way I guess mostly for SEO

The second rule for the lowercase works good but what I'm looking for is to avoid double redirections (one for the slash and one for the case). For example, if now I go towww.mysite.com/ADMIN i have 2 redirects, one that switch to lowercase and the other that adds the /
It would be nice to have all processing done and if any processing has been done have a single redirect to the normalized url.

Here are the rules in my web config (ASP.NET 4.5 Web Forms scenario)

<rewrite><rules><rule name="RemoveTrailingSlash" stopProcessing="true"><match url="(.*)/$" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Redirect" url="{R:1}" redirectType="Permanent" /></rule><rule name="LowerCase" enabled="true" stopProcessing="true"><match url="[A-Z]" ignoreCase="false" /><action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" /></rule></rules></rewrite>


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>