Is it OK to have a case insensitive URI?

6,155

Solution 1

Domain names are case-insensitive. WEBAPPS.STACKEXCHANGE.COM is the same as webapps.stackexchange.com

Everything after the slash is up to the web server to handle. Depending on the web server software in use or the settings the server is using, that part of the URL may be case-sensitive or may be case-insensitve.

As ChrisF showed, the webapps.stackexchange.com server doesn't care what case is used. But this isn't always the case. For example, google.com/services is different from google.com/SERVICES. Or as another example, in a YouTube URL, the video ID (the v= part) is case sensitive.

As EricSchaefer pointed out, if you decide to allow case-insensitive URLs to return the same page, search engines may or may not recognize they're the same page. A search engine may notice the URLs are returning the same page and choose one version of the URL to show in the search results. Or it may not notice they're the same page, which might cause all versions of the URL to rank lower in the search results.

If you decide to allow case-insensitive URLs to return the same page, you may want to choose one version of the URL to be the "official" URL, and have all the other case-variants redirect to it using a 301 response header. Or you may want to specify the "official" URL using a canonical meta tag. This way users can enter the URL using any case, but search engines will know the official URL to use for search results and ranking purposes.

Solution 2

Usually it is not a good idea (SEO-wise) to have a resource be accessible by multiple URLs. Search engines regard /foo and /Foo as different URLs.

Yes, a page is allowed to have any combo of upper/lower-case letters.
But no, don't do it.

Solution 3

Urls are case sensitive, but domains are not. It is not good practice to have them be case sensitive unless if you are using base64 url redirecting like bit.ly and tiny url.

If your site is on a windows server running IIS then it is likely case insensative to begin with. IIS cannot do case sensitives out of the box.

So, good practice is, using all lowercase urls.

Share:
6,155

Related videos on Youtube

Xeoncross
Author by

Xeoncross

Updated on September 17, 2022

Comments

  • Xeoncross
    Xeoncross almost 2 years

    If I have a URL like /writes/about/star-wars, and it is also accessible to users by /wRitEs/ABOUT/star-WARS, is that considered another page? Is a page allowed to have any combo of upper/lower-case letters?

    I know on Linux you can have my.file and My.FILE in the same folder so I was wondering if web pages work the same way. If so, I plan to stop supporting both paths and only allow the real one.

  • Jonx
    Jonx over 13 years
    +1 The related specification is RFC 2616 Section 3.2.3 URI Comparison and it reads: "When comparing two URIs to decide if they match or not, a client SHOULD use a case-sensitive octet-by-octet comparison of the entire URIs" (though exceptions exist for hostnames)
  • MrWhite
    MrWhite over 13 years
    If you allow case-insensitive URLs, always link to it by the 1 canonical URL. I would have thought that any variations in the case of the URL are likely to be typos of which there would hopefully be few. @Bavi_H On a server that allows case-insensitive URLs can you detect incorrect case URLs in order to do the 301 redirection, without actually first disabling case-insensitivity on the server?
  • Bavi_H
    Bavi_H over 13 years
    @w3d I only have a tiny bit of experience with a case-sensitive server. You'll have to refer to your web server's documentation to see how you can handle case variation in URLs. If 301 redirection isn't feasible, you can at least consider using the canonical meta tag as a way to tell search engines the preferred URL.
  • Scott Mitchell
    Scott Mitchell over 13 years
    I agree that having duplicate URLs is not a good thing when it comes to SEO, but you can mitigate that problem by specifying a canonical URL via the <link rel="canonical"> tag, as discussed here: googlewebmastercentral.blogspot.com/2009/02/…