Are URLs on your servers “case sensitive”?
Our web servers usually do not treat URLs as being case sensitive. This means that your visitors likely won't see an error page if they follow a link that accidentally points to a file named "mypage.html" on your website if the file is actually named "MyPage.html": they'll see the "MyPage.html" file, just as you probably expect.
However, there's a little more to it than that, and relying on the web server to fix differing case can cause problems and isn’t recommended. The sections below have more details:
- Some background information
- So do these kinds of links work on Tiger Technologies servers?
- Case-sensitivity and WordPress
- Some technical details
Some background information
We should first explain exactly what we mean by “case sensitive URLs”. Some web servers (usually Unix servers) consider all URLs to be case sensitive. That is, they would treat each of the following URLs as referring to a different file and web page:
http://www.example.com/mypage.html http://www.example.com/MyPage.html http://www.example.com/MYPAGE.html http://www.example.com/MYPAGE.HTML
If you visited “http://www.example.com/mypage.html” but the file was actually named “MyPage.html”, these kinds of servers would display a “file not found” error.
But other web servers (mostly Windows servers) would treat all these URLs as requests for the same file, because they use a file system that doesn’t care about capitalization. Using an incorrectly capitalized link on these kinds of servers doesn’t cause an error.
It’s always best to avoid this problem entirely by making sure that the capitalization of any URL links matches the capitalization of your file names, ensuring that your files work on any kind of server. However, if you have an existing site, these errors can be difficult to find.
So do these kinds of links work on Tiger Technologies servers?
Usually. Our servers use special software that (in most cases) makes simple URL links to actual files work even if they contain capitalization errors. In other words, although we use Unix servers for reliability, our servers treat URLs in the same forgiving fashion as Windows servers.
That means that if you’re transferring your website from a Windows server to Tiger Technologies, you usually don’t need to worry about fixing the capitalization of links to avoid “file not found” errors. If your file is named “MyPage.html” and you have a link referring to “mypage.html”, it will probably work, just as it did on a Windows server.
That’s not to say that you shouldn’t try to make your URL links match your filenames, because there are cases where it won’t work, such as URLs managed by scripts like WordPress and other URLs that are modified by .htaccess files.
Case-sensitivity and WordPress
If you use WordPress to manage your site, WordPress adds a rule to the site’s .htaccess file that says “make WordPress handle requests for any URL that doesn’t exactly match a file path on the disk, even if the only difference is the case of that path”.
So if you use WordPress to handle most pages on your site, but you also have “file.pdf” in a directory called “PDFs”, you’d need to access it using this exact URL:
If you instead tried accessing it using “pdfs” as the directory name, like this:
... it wouldn’t work, because WordPress would notice that there was no file at that exact case-sensitive file path, and would handle the request itself (probably showing a “page not found” error).
Some technical details
Advanced users may be interested in knowing how URLs can be case insensitive even though Unix servers use a case-sensitive file system. The answer is that we use an Apache Web server module called mod_speling (sic), which “fixes” URL requests that don't exactly match an existing file. We have mod_speling configured to look for matches that differ only in terms of case, which usually “does the right thing” by issuing a redirect to the correctly capitalized version.
We should mention that there is a (quite rare) potential issue when relying on mod_speling to fix miscapitalized links, which is that mod_speling does not change the fact that the actual file system can still allow files with different capitalization to exist simultaneously. This can cause subtle problems if you mistakenly upload two files with names that differ only in capitalization.
For example, if you upload a file named "mypage.html", then later upload a file named "MyPage.html", both files will exist on the disk, just as they would on any Unix server. The second upload will not replace the first file as it would on a Windows server. If you then use a link named "mypage.html", you're always going to see "mypage.html", even though you might be expecting to see the new "MyPage.html" file you more recently uploaded. Stranger still, if you use a link that doesn't match either file — say, "MYPAGE.HTML" — you'll appear to get one of the files at random. Again, just make sure that your link capitalization matches the file names you upload to avoid any potential problems.
Copyright © 2000-2022 Tiger Technologies LLC