1

I'm a complete newbie with regard to managing Apache, so excuse me if I'm phrasing something incorrectly.

I have a web site -- say, http://domain.com. The problem is that when I try to open http://domain.com/index.html in a web browser it displays the page, but when I attempt to access http://domain.com/Index.html (note capital I), it responds with HTTP 404.

How do I configure Apache to serve both these files (and directories, for that matter) in a case-insensitive manner? Current httpd.conf is here.

EDIT Dan C, thanks for a hint. I basically want to allow users to download files from my server and don't really want them to be aware that Index.html and index.html are in fact different.

I'm also very willing to know as to what are the ramifications of this decision.

Anton Gogolev
  • 1,582
  • 4
  • 16
  • 22

3 Answers3

2

The first thing that comes to mind is mod_rewrite, which is already loaded in your config.

Assuming your files are all in lower case (this may be a dangerous assumption):

RewriteEngine On

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^(.*)$ ${tolower:$1} 
Matt
  • 933
  • 5
  • 12
2

If you are running apache on a linux server the problem is that it uses the underlying linux case sensitive file system, you could look at ReWrite as mentioned by matt.

Another option is the mod_speling module (yes it is one L) for apache, mentioned > here < but I think that will only look for one spelling error and also might slow access down if there is a lot of files in one directory

Hope that helps

Rodent43
  • 697
  • 3
  • 11
1

It doesn't really work with httpd.conf. As said, the problem is that the Linux-filesystem you're on is case-sensitive.

I know of one method that works for sure: Put your web-application into /opt/www/yourapplication

Then make an SMB share of /opt/www for localhost only

then mount the Samba share to /var/www

Samba is for Windows-shares, and windows shares are case-insensitive, so Samba will take care of the case-sensitiviy for you, making everything LOWERCASE internally.

Quandary
  • 1,024
  • 4
  • 19
  • 36
  • Addendum: You can also create a VFAT file system and permanently mount it, see http://ubuntuforums.org/showthread.php?t=1497253 for more information. That way you don't need samba, which means this way it is far more secure and stable. – Quandary Dec 24 '11 at 08:16