12

My website's URLs are currently case-insensitive. For example, both of the following links show the exact same page:

  • http://example.com/about
  • http://example.com/About

However, taking a look at the wordpress.org website, I noticed that URLs are case-sensitive. For example, the second link below is a 404 error page:

  • http://wordpress.org/about
  • http://wordpress.org/About

My thoughts are to make my website's URLs case sensitive. Aside from the obvious issue of avoiding duplicate content, what are the pros and cons of having case-sensitive URLs?

Update

Google seems to operate a case-sensitive URL policy on their own URLs. For example, the second link below is a 404:

  • http://google.com/doodles
  • http://google.com/Doodles

Update 2

Thanks for your answers. I decided to take the advice mentioned in the accepted answer and implement 301 redirects where necessary. Since I'm working with WordPress, my code solution is as follows (in case anyone is interested):

function force_lowercase_urls() {

    if ( is_admin() )
        return;

    if ( preg_match( '/[A-Z]/', $_SERVER['REQUEST_URI'] ) ) {

        wp_redirect( strtolower( $_SERVER['REQUEST_URI'] ), 301 );
        exit();
    }

}
add_action( 'init', 'force_lowercase_urls' );
3
  • 1
    But wouldn't that result in duplicate content? – henrywright You never need to worry about duplicate links if your site uses canonical links correctly and you can have 1 page accessed a million ways and never be affected for duplicate content. Commented Oct 4, 2014 at 19:37
  • @bybe If you have one page accessed millions of ways, Googlebot won't be able to crawl your site well. Having a page accessed a handful of ways isn't likely to hurt. Commented Oct 4, 2014 at 22:13

3 Answers 3

7

Two of the most widely used operating system file systems for serving web content have have very different settings for case sensitivity of URLs by default. Whether or not your URLs are case sensitive is likely a function of which you are using:

  • Microsoft IIS running on Windows - case insensitive URLs - shows the same content regardless of capitalization.
  • Apache HTTPD Server running on Linux - case sensitive URLs - gives a 404 not found error for incorrect capitalization.

In my opinion, neither default is ideal:

  • Showing the same content regardless of capitalization makes crawling your web site harder. Search engines consider the same content on multiple URLs to be duplicate content.
  • Showing error pages for incorrect capitalization is not user friendly. Users are not usually mindful of capitalization when they type.

The ideal solution would be to show the page only when the URL is correctly capitalized. For incorrect capitalization, the user should be 301 redirected to the preferred capitalization. There are some ways that this can be accomplished:

6
  • 1
    I feel this is an artifact of DOS and Windows deviating from the previous standard of case sensitivity we have in Unix environments.
    – Sun
    Commented Oct 9, 2014 at 3:46
  • 1
    Whether Apache is case-sensitive for requests that map to the filesystem is dependent on the underlying filesystem, not Apache itself. If running Apache on Windows then requesting /iNdEx.HtMl or /InDeX.hTml will both return /index.html (providing that /index.html is a physical file on the filesystem).
    – MrWhite
    Commented Feb 23, 2016 at 2:05
  • 1
    In fact, this would seem to be the same for IIS.
    – MrWhite
    Commented Feb 24, 2016 at 1:05
  • 1
    Well, IIS always runs on Windows (AFAIK), so filesystem requests will always be case-insensitive. However, many sites will route (rewrite) URLs through some kind of front controller - in this case the request probably does not map to a physical file on the filesystem and so the URL is probably case-sensitive (unless the app specifically makes it case-insensitive) - which is basically the same as Apache (when running on Windows). (?)
    – MrWhite
    Commented Feb 24, 2016 at 2:32
  • 2
    I actually stumbled through here whilst researching the recent/busy question "Why are URLs case-sensitive?". It seems that phrases like "IIS is case-insensitive" (mentioned several times in that other thread) are so widespread that common belief appears to be that URLs on IIS are always case-insensitive - at least that's the impression I was getting - which does not appear to be the case at all.
    – MrWhite
    Commented Feb 24, 2016 at 2:38
4

Here is Google's position from an archived live chat session (the link is now dead):

*Does inconsistent capitalization of URLs cause duplicate content issues and dilution of page rank? For example www.site.com/abc vs www.site.com/Abc. On Windows hosts, these are the same page, but are different pages on Unix hosts.

JohnMu: Hi John, based on the existing standards, URLs are case-sensitive, so yes, these would be seen as separate URLs. Since the content on the URLs is the same, we'll generally recognize that and only keep one of them. However, we'd recommend that you try to keep all links going to one version of the URL. Keep in mind that this also applies to robots.txt files.*

The IE Team recommends picking a file casing convention and adhering to it strictly as it can improve performance.

-2

RFC 3986 6.2.2.1 defines URIs as case-insensitive, so it is not a good idea to make them case-sensitive like wordpress.org does.

4
  • But wouldn't that result in duplicate content?
    – henrywright
    Commented Oct 4, 2014 at 16:16
  • Actually not, because search engines should work case-insensitive too.
    – Andreas Krischer
    Commented Oct 4, 2014 at 16:19
  • I suppose the question now is how to find out if search engines view upper and lower-cased URLs as equivalent? Take Google for example: Try google.com/Doodles and google.com/doodles
    – henrywright
    Commented Oct 4, 2014 at 16:35
  • 11
    That RFC only addresses the case of three parts of the URL. 1 - The protocol (http://) - case insensitive, normalize to lower case. 2 - The host name (example.com) - case insensitive, normalize to lower case. 3. Percent encoded characters (%3F) - case insensitive, normalize to upper case. The rest of the URL is generally case sensitive Commented Oct 4, 2014 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.