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.

1
  • 1
    It would be good to add why you wish to do this and whether you wish to apply it to other files as well.
    – Dan Carley
    Jul 10, 2009 at 14:39

3 Answers 3

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} 
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

1
  • 2
    If using on Apache 2.2 this can even be limited to case only by using CheckCaseOnly directive. Jul 10, 2009 at 15:46
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.

1
  • Addendum: You can also create a VFAT file system and permanently mount it, see 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, 2011 at 8:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .