You could match uppercase characters in URLs in UrlRewriting with /(.*[A-Z].*), but I can't see any way to convert them to lowercase in the destination URL without using some .NET code.
I knew if was too good to be true..... the .htaccess file works on the client side of the website but in the Umbraco backend its causing problems when saving in the settings and developers tabs.
I'm now getting errors when trying to save css / templates or xslt files.
The added rewrite rule will match any incoming URL that starts with an uppercase letter and ends with .aspx. It will then perform a case-insensitive redirect to the lowercase version of the URL.
Case insensitive URL rewrite rule
I have a need to redirect incoming URL's like domain.co.uk/Services.aspx to domain.co.uk/services.aspx
Is this something to be completed using ISAPI or in the UrlRewriting.config file ?
There is an ignoreCase option on the UrlRewriting.config rewrites, so I imagine something like this would work (haven't tested):
<add name="MyRedirect"
ignoreCase="false"
rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="http://domain.co.uk/Services.aspx"
redirectMode="Permanent"
destinationUrl="http://domain.co.uk/services.aspx" />
What about if I wanted a wildcard redirect i.e any uppercase URL to a lowercase URL ??
This is my current rewrite rule in .htaccess file to add www to non-www addresses:
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
Sorry, misunderstood your question.
You could match uppercase characters in URLs in UrlRewriting with /(.*[A-Z].*), but I can't see any way to convert them to lowercase in the destination URL without using some .NET code.
I don't know much about .htaccess, but this example seems to work using IIS7 Rewrite Module: http://www.webmasterworld.com/microsoft_asp_net/4027908.htm
Thanks Tom, I've hopefully sorted it using a .htaccess file.
RewriteEngine on
RewriteBase
#This section ensures the URL is changed to include the www
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
#This section rewrites any uppercase characters to lowercase
RewriteCond %{HTTP_HOST} (.*)
RewriteRule ^(.*[A-Z].*)$ http\://%1$1 [R=301,CL,L]
I knew if was too good to be true..... the .htaccess file works on the client side of the website but in the Umbraco backend its causing problems when saving in the settings and developers tabs.
I'm now getting errors when trying to save css / templates or xslt files.
Anyone know how to achieve this using the inbuilt rewrite engine in Umbraco:
<rules>
<rule name="Convert to lower case" stopProcessing="false">
<match url=".*[A-Z].*" ignoreCase="false"/>
<conditions>
<!-- The following condition prevents rule from rewriting requests to .axd files -->
<add input="{URL}" negate="true" pattern="\.axd$"/>
</conditions>
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent"/>
</rule>
I need to convert www.domain.co.uk/Services.aspx to www.domain.co.uk/services.aspx using a wildcard type pattern.
Add a rewrite rule
Inside the
The added rewrite rule will match any incoming URL that starts with an uppercase letter and ends with .aspx. It will then perform a case-insensitive redirect to the lowercase version of the URL.
is working on a reply...