I am looking to setup a URL rewrite rule in my web.config that will modify the following URL:
/detail.aspx?aID=164&mode=t
To (see case of aid
):
/detail.aspx?aid=164&mode=t
Please can anyone assist me with this? The only other thing to mention here is that the rule should still work if there is no mode
parameter at the end and irrespective of what order the aid
parameter appears in the querystring.
EDIT 1
I found this guide which rewrites the whole URL to lowercase. This would work for me only the accepted solution seems to ignore the query string values.
How to display URL in lower case?
EDIT 2
I'm now using the following to issue a 301 redirect when uppercase characters are found. the accepted answer addresses the original question but this solution works on the full URI, domain, path and querystring.
'301 REDIRECT ON UPPERCASE URIS
Dim fullUri As String = Request.Url.AbsoluteUri
If fullUri.Any(Function(c) Char.IsUpper(c)) Then
Response.RedirectPermanent(fullUri.ToLower)
End If