Are URLs Case-Sensitive? How to Redirect Uppercase URLs to Lowercase URLs Using Htaccess or httpd.conf

google search for how to redirect uppercase urls

google search for how to redirect uppercase urls

Editor’s Note: This post was originally published on May 15, 2013, and has been updated for completeness and accuracy.

It may surprise you but, yes, URLs are case sensitive. And, if you have both upper- and lowercase versions of your site’s domain, you may be unintentionally making Google’s job harder — and hurting your site’s own performance.

If a page on your site can be accessed with both uppercase and lowercase letters, Google will treat every variation as a separate version. And that’s because, technically, those URLs could be unique versions. On Apache servers, you have the ability to show completely different content on URLs that have the same page name when the page name has different cases (for example: /case-sensitivity vs. /Case-Sensitivity).

Google, like any other computer system, will read a line of text and treat uppercase and lowercase letters differently!

Having a mix of uppercase and lowercase URLs on your website isn’t always a problem, as long as the search engines aren’t able to find both versions. But making that happen does require some precautions; otherwise, it can cause some major headaches down the road.

Here are a few reasons why you need to consider case sensitivity on your website.

  • Case sensitivity can result in 404 errors.
  • Search engines consider uppercase and lowercase URLs to be different pages.
  • Search engines will consider variations of the same page to be duplicate content (learn more about that here).
  • Google might index the version of the URL you don’t want to be indexed.
  • Pages will show up as duplicates in analytics.

How Different Servers Handle Case Sensitivity

Windows servers are normally case insensitive, so upper- and lowercase URLs typically won’t be a problem there. However, there are some drawbacks to these servers. For one, Windows servers typically cost more than Linux servers. They also don’t have as much freedom as Linux servers do, so most people choose to host their websites on Linux.

Linux servers are case sensitive, and this is where you normally run into issues (more on that below).

Some popular eCommerce platforms (such as Volusion and Shopify) default to allowing both uppercase and lowercase URLs to be accessible, so you’ll need to take extra steps to make sure only one version is accessible and/or linked to throughout the site. While not common, we sometimes see businesses purposely linking to uppercase versions of pages of their site in the main navigation, footers, or other places of the site, even when lowercase is the default.

Why Case-Sensitive URLs Matter

Case Sensitivity Can Cause 404 Errors

If you create a page on a Linux server with capital letters and someone tries to visit that page with lowercase letters, the user will reach a 404 error page (unless redirects are in place).

This can happen as a link gets passed along through emails, newsletters, social media, and blog mentions. Somewhere along the line, someone might decide that they don’t like the look of the uppercase letters and change them to lowercase without testing the URL. We see this all the time while reviewing backlink data for our clients or their competitors.

This can also happen when a site goes through a redesign and a developer decides to change all pages from uppercase to lowercase. All of those old URLs could become inaccessible, and all of the links on the internet going to those pages will break.

Many CMSs like WordPress and Drupal will automatically fix case-sensitivity problems with redirects, so it might not be a problem with your platform, but always check to make sure!

Google Gets Confused

Google sees non-www and www versions of a website as two different URLs — and it’s the same for uppercase and lowercase versions of the same page. This can spread page authority and link equity among two pages when, instead, you should be sending it all to one page and giving it the ability to rank as highly as possible. 

You can often verify this in Google Analytics (GA) and Google Search Console (GSC). If GA shows multiple versions of the same page getting traffic, it’s likely that those pages are showing up in the search results, possibly with different rankings. And in GSC, you can check to see what keywords each version is ranking for and how well they rank for those keywords. 

Below is a real example. I can’t share the full URL, so you’ll just have to trust me that it’s the same page.

Google Analytics results for uppercase and lowercase versions of same page, showing difference in number of impressions

Google Analytics results for uppercase and lowercase versions of same page, showing difference in number of impressions

It’s likely that you’ll find one version ranking better for certain keywords than the other. Both pages are canonical to the lowercase version, and the site has only linked to the lowercase version for several years, yet Google ignores the canonicals.

This is one example of why I believe that canonicals are a good signal, but they’re not reliable. I always recommend 301 redirects in this case.

It May Even Index the Wrong Page!

Even short-lived uppercase URLs can have long-lasting effects if Google indexes those pages.

One of our clients made the mistake of linking to uppercase and lowercase URLs throughout their site and sitemap years ago. To this day, Google continues to index their uppercase URLs, even after years of specifying lowercase canonicals and updating the XML sitemap.

Redirects can fix these issues most of the time (more on that below), but because our client’s platform doesn’t allow for those, Google continues to index a mix of upper- and lowercase pages across the site.

Analytics Data Issues

I’m not sure how it works with other analytics programs, but in Google Analytics, uppercase and lowercase versions of the same page show up separately, each with their own data.

Here’s an example of the same page mentioned above:

Google Analytics results for uppercase and lowercase versions of same page, showing difference in number of users and sessions

Google Analytics results for uppercase and lowercase versions of same page, showing difference in number of users and sessions

If you don’t think to look at data for all versions of the same page, you’re not getting an accurate representation of how that page is performing.

By the way, if you do have this issue in GA, you should create a new GA view that filters all data to either uppercase or lowercase (whichever version you want to use). Here’s a great walkthrough showing how to set that up.

At Inflow, we always leave a “raw” unedited view in our client’s GA accounts, and then we create a new clean view with filters like this.

Why Do People Create Uppercase URLs Anyway?

Screaming girl with text: "Oh noes!!! I got caps all up in my URLs! What do I do?!?"
Screaming girl with text: "Oh noes!!! I got caps all up in my URLs! What do I do?!?"
*Image courtesy of CortneeB

Now that you know why capital letters do matter in URLs, using them may seem clearly counterintuitive.

But there are actually several good reasons why someone might want to capitalize page URLs.

  • Readability (such as for pay-per-click, print, or television ads)
  • Branding purposes
  • Visual preference

Readability and branding are the most common reasons that people display their URLs with capital letters. We used to see it all the time in pay-per-click ads, but the search engines automatically convert URLs to lowercase in ads now. Branding is another big reason for capitalizing letters in URLs, especially when handing out print materials that have special landing pages or on social media.

For any of the above reasons, someone might visit your website by typing the URL with capitalization, or they might type it in lowercase, even if you’ve displayed it capitalized. People might link to your site both ways too, so you either need to make sure both uppercase and lowercase versions are accessible or that only one version is accessible and the other redirects.

How to Redirect Uppercase URLs to Lowercase

If you only have a few pages with capitalized URLs, you can simply set up some easy 301 redirects. If you have a ton of pages that need to be redirected though, you’ll probably find it much easier to implement a site-wide fix.

Option 1: Enforcing Lowercase URIs with Rewriting

The preferred method is to use server config files in your HTML code. If you have access to your httpd.conf file, try this method. It’s clean and works well. If you don’t have access to your httpd.conf files, your hosting company might be willing to turn the feature on for you.

Option 2: htaccess Redirect to Lowercase

An alternative method is using the htaccess file. Depending on the Apache version your server is running and any other rules already running in your htaccess file, this method can be buggy. On some servers, this can break images or cause the site to suffer from decreased speed. We’ve even received several comments from people who have tried the htaccess method and have caused their entire site to show a 500 status error. We’ve tested it on a few small sites and we didn’t have any issues, but you need to be very careful with this method.

If you want to try it, AskApache.com compiled this set of htaccess rules. Make sure your site is working properly after implementing this code before walking away from your computer!

I suggest setting up redirects for all of your sites, whether you have a URL problem or not, just as a handy catchall to prevent problems in the future. Preventing a problem now is much easier than trying to fix it later!