This project is read-only.

Lowercase Url for SEO - Issues

Topics: ASP.NET 2.0
Sep 5, 2011 at 12:24 PM

The Goal: I am trying to force each Url of my site to be lowercase as part of my search-engine optimization (SEO) strategy. As I continue to build-out my site, I plan to have lots of content and want to try to adhere to the fundamental SEO principles. Using lowercase Url's prevents search engines like Google from diluting your page rank value since only 1 Url exists for that content. Mixed case Urls can be double counted by the search engines as they crawl your site and possibly devalue your overall search position. The typical approach to remedy this issue is to use the following rewrite rule in the web.config file. 

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

The Problem: I noticed in version 2.0.36 and the latest 2.5 version that implementing this rule will cause problems when trying to create or edit a post. The "save" button simply won't fire. I have tested repeatedly and definitely confirmed that the inclusion of this rule will break that functionality.

Workarounds? Is there a possible workaround to this problem or a permanent fix available? My thought was to: 1) put code in the page_load event somewhere to check that requested Url and compare it to the lowercase version. If it doesn't match, simply do a permanent redirect to the lowercase Url (see below) 2) Option 2 was to modify the existing core code that generates the Url and simply force it to be lowercase. While I think both options would work, I really don't know where to make those changes and how many places in the code need to be modified or whether any extensions exist to solve this problem. Any help or suggestions is greatly appreciated!

if (Request.Url.ToString().ToLower() != Request.Url.ToString())

Sep 15, 2011 at 8:01 PM

I have been trying to do the same thing, lowercase url for SEO, the problem you identify is larger than just saving.

The problem is that Services are case sensitive and when you run this rule then all urls are lowercased which causes lots of problems, for instance I can't connect with Windows Live Writer and the Posts page in Admin doesn't show any posts.

I'm not sure what the best solution is here - probably there's no need to worry about any of the admin pages being lowercase though... my my regex-fu isn't that strong. 

Oct 25, 2011 at 9:51 PM

When you make [Pages/Posts]  use the "Slug" to name them, instead of the title for the url.

When you use the slug use all lowercase letters.

For [Pages/Posts] that are already made go through them and edit them using the slug.

Look at the screenshot below:



Hope this helps,

Brian Davis

Java Blog

Mar 20 at 10:19 PM
I have the same problem using rule name lowercase in web.config. I can't save Post..

Where i must to use Slug ?? Screenshot isn't more available :-(