Case-Sensitive URL's

(occurs with websites hosted by UNIX web servers (Apache, etc.)

The resulting 404 Error Pages - and the fix (custom 404 page)

This is a hellish problem, to be frank.  Out of the thousands of people that visit your website, very few will bookmark it, and even less will ever visit again.  But there may be quite a few that try to visit again - by memory.  They simply type in your URL.  But if it is case-sensitive, about half will miss your website !!!

UNIX is a case-sensitive command-interpreted language.  The files and the paths are case-sensitive.  This is great for user ID's and Passwords, but not so great for paths, folder names, and file names.  It makes everything suddenly very confusing.

The Problem with Case-Sensitive URL's

First - there are two possible cases of a bad URL being entered in as an address in a browser:

1)  bad URL's with no known domain  -  for example,  www.kjsdflsiueg.com

2)  a valid domain but the rest of the address does not exist - for example,  www.usatoday.com/lkjsyhsliu.htm

Which Part is Case-Sensitive

The "path" (the part that "follows" the domain), on UNIX web servers - is case-sensitive.  

*** on Windows web servers, there is no case sensitivity anywhere in the entire URL, including the path !!!

So the domain in almost always case-insensitive, even on Apache UNIX servers.  But the rest of the URL is case-sensitive.  For example, on this website I maintain a video section.  If you type in any of the following - it will get you there - no problem  (the case-sensitive portion of the URL's are in red):

http://www.infocellar.com/Video/index.htm
http://www.infoceLLar.com/Video/index.htm
http://WWW.infoCELLAR.com/Video/index.htm
http://WWW.infoCELLAR.COM/Video/index.htm

But if you alter the "path" as follows - you will get the 404 error page:

http://www.infocellar.com/VidEo/index.htm   - used a capital "E" in the word, Video (web server has the pages stored in a folder named "Video" and it is case-sensitive

http://www.infocellar.com/Video/WillyNilly.htm  -  the html file name you entered does not exist on the server

 

The actual Error Pages that pop up when you type in a Bogus URL

The error pages that you have seen, are all actual web pages !!  There may be If you type in an address with no known domain - you will get the "Cannot find Server" page

If you type in a known domain but the web page does not exist on that server, you will get the 404 error page.  This can be the default 404 error page, or it can be a customized error page that the webmaster created.  For example, if you type in "www.

web servers and websites can deal with There are several common error pages that are displayed when you type in a URL that doesn't exist.  But quite often the error page is a result of a single letter being the wrong case !!

If the page can't be found, you'll see:

"404 Not Found"  or  "Cannot Find Server"

Or, if an error occured, you will see:

"500 Internal Server Error..."

Samples of the error pages

***  NOTE:  not that you would ever want to save them - but as an FYI, some of the error pages do not save correctly using Internet Explorer.  Instead it may save a blank, empty, default page.  The workaround is to click "View/Source", which will display the HTML code in Notepad, then save it from there.

1)  "Cannot find Server" error pages- these are non-numbered error pages.  If you type in any silly address, such as "www.lkjhsgvfskjhg.com you get the "Cannot find Server" page.  The text heading says "The page cannot be displayed" but the title of the page (look at the blue title bar at the top of Internet Explorer) is "Cannot find Server".  Also, if you then click "File/Save as . . ." you will also see that is prompts you to save the file with that name.  Here is the page :

The page cannot be displayed

The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

Please try the following:

  • Click the refresh.gif (82 bytes) Refresh button, or try again later.
  • If you typed the page address in the Address bar, make sure that it is spelled correctly.
  • To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP).
  • If your Network Administrator has enabled it, Microsoft Windows can examine your network and automatically discover network connection settings.
    If you would like Windows to try and discover them,
    click Detect Settings Detect Network Settings
  • Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed.
  • If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0.
  • Click the Back button to try another link.


Cannot find server or DNS Error
Internet Explorer

2)  404 "Page cannot be found" - or "Page does not exist" error pages - if you type in a correct domain on my own website but change the case of the path or enter a path or an html file name that does not exist -  for example,  www.infocellar.com/hdtegdfgasf.htm, you get the following common version of a 404 error page (there is one other very common version, with the "404" in large bold text at the top):

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.

Please try the following:

  • If you typed the page address in the Address bar, make sure that it is spelled correctly.
  • Open the home page, and then look for links to the information you want.
  • Click the Back button to try another link.
  • Click search.gif (114 bytes) Search to look for information on the Internet.


HTTP 404 - File not found
Internet Explorer

3) 500 Internal Server error pages - if you type in the address "http://flyingchutes.com/" you will get the following 500 error page.  If you save it, all you get is a blank page - the workaround to save these is to click "View/Source", and save the HTML code from there:

The page cannot be displayed

There is a problem with the page you are trying to reach and it cannot be displayed.

Please try the following:

  • Open the home page, and then look for links to the information you want.
  • Click the refresh.gif (82 bytes) Refresh button, or try again later.
  • Click search.gif (114 bytes) Search to look for information on the Internet.
  • You can also see a list of related sites.


HTTP 500 - Internal server error
Internet Explorer

 

 

Custom 404 Error Pages

*** see http://www.404-error-page.com/ 

Virtually all serious webmasters create a custom 404 error page for their site.  We won't go into great detail on that here (see the above website for that).

As an example, if you type in www.usatoday.com followed by a page that does not exist, such as www.usatoday.com/kjhgskfjg.htm  -  you will get the following custom error page:

 

And of course, that is an actual web page that exists on their server - but it only exists for the purpose of telling users that they typed in an address that does not exist.

The custom 404 error page can contain anything - here's a fun one drawn by an excellent artist, Sara Howard (see her website at www.matrices.net ):

 

The Fix for case-sensitive URL's to your Website

In a nutshell, you can create a custom 404-file that converts the URL into lowercase, using javascript. 

We all have seen the dreaded 404 page  .  .  .  the error page that you see whenever you type in a URL that doesn't exist.

UNIX-servers are case-sensitive - they distinguish between upper-case and lowercase letters in file names and folder names. So if you move your website from a windows to a UNIX-server (when you change web host for instance), you risk getting a certain amount of "Page not found"-errors (404 errors), because directories and other websites linking to yours sometimes get the cases wrong (typically writing the first letter of folder names in upper-case etc.).

Usually, you can get access to editing your custom 404-page. Just ask your web host to set the 404 page to the file 404.htm in the root of your website.

Then, you have two things to do:

 



<html><head><title>Page not found</title>
<meta name="robots" content="noindex,nofollow">

<script language=javascript>
<!--

// The three functions are general read, set and delete cookie-functions -
// copied from this page: http://www.echoecho.com/jscookies02.htm

// The rest of the javascript is specificallye made for 404-files on casesensitive servers
// it converts the url til lowercase to see if the reason for the 404 error is one ore more uppercase letters
// *** NB! - make sure all folder and file names on the website are written in lower case ***
// Copyright: Forbrugerportalen, 2004
// http://www.forbrugerportalen.dk/sider/casesensitive404-english.htm




varURL=top.location.href;


function getCookie(NameOfCookie)
{

if (document.cookie.length > 0)
{
  begin = document.cookie.indexOf(NameOfCookie+"=");

  if (begin != -1)
  {
    begin += NameOfCookie.length+1;
    end = document.cookie.indexOf(";", begin);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(begin, end));
  }
}
else
{
return null;
}
}



function setCookie(NameOfCookie, value, expiredays)
{
  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}



function delCookie (NameOfCookie)
{
  if (getCookie(NameOfCookie))
  {
    document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}



strLowcase=getCookie('lowcase');

if (strLowcase!=null)
      // If the cookie exists, the adress has been converted to lowercase and still results in a 404-error

{
   document.write("The page <b>" + varURL + "</b> was not found.<br><br>");
  document.write("<a href='/' target='_top'>To homepage...</a><br><br>");
  delCookie('lowcase');
}

else
      // If the cookie doesn't exist, the URL is converted to lowercase
{
  setCookie('lowcase',"on",(10/86400));
      // The cookie is set to expire in 10 seconds
      // - because anothere problem with casesensitive URL's can arise again in the same session
  varURLsmaa=varURL.toLowerCase();
  top.location=varURLsmaa;
}


-->
</script>

</head>
<body>
&nbsp;

</body></html>