Welcome, Guest. [ Log In ]
Question   Is there any way around directories being case sensitive?
Search KBase


Top 5 in this Area:
1. How do I set up CVS?
2. How long does it take for changes to become active?
3. Can I have an adult website or dreambook?
4. About DreamHost
5. What Happen?

 
Is there any way around directories being case sensitive?
Hi, Is there any way around directories being case sensitive? I had realized that filnames were case sensitive, but not directory names. So if someone tries to go to: www.mydomain.com/MyDirectoryName and it's really www.mydomain.com/mydirectoryname They'll get the 404 error. Is there any way around this?

Last updated: Aug 11, 2005.

User Post (2001-05-04 06:46:45 by josh)
Sorry but there really isn't. In unix systems, both directories and file names are case-sensitive. Domain names, however are not!<p>
Really you should just make sure that all your links are correct, and maybe just standardize on all lower-case directories and filenames.<p>
You COULD, if you were a stud programmer, make your 404 file actually be a cgi script which reads in the environment variable for the URL it is at, and then lower cases it, and checks if the lower-case version exists, and if so, redirects you there, and if not, outputs a 404 page..<p>
But that'd be a lot of work!
User Post (2005-10-27 12:06:51 by alifana)
I'd just like to point out that the guy that talked about using RewriteMap in .htaccess was wrong. RewriteMap is not possible from .htaccess, only from server config and virtual host config. This means from httpd.conf, not from .htaccess. I've tried to get this working for a couple days now per the instructions provided above, but found that I got 500 internal server errors with that directive included. I'm not sure how to do a virtual host config, or if it's possible by me to do it.
User Post (2005-05-17 06:17:49 by bcole)
Hey all,

I ran into the "using linux filesystem case sensitivity" problem. The solution I am implementing is to simply rename every file and directory to lowercase in Windows (XP SP2) before I upload. Also, any HTML and PHP files must reference a lowercase filename so remember to code accordingly.

I've written a little script that helps me rename files to lowercase quickly. I've timed it to 2000 files and 20 folders in 1 to 2 seconds.

Here it is: http://computerhelp.no-ip.info/gordon/tools/lowercase/

Make sure to read the file_id.txt.

I AM NOT supporting or spending time making this script more user friendly or teaching someone how to use it, well, unless you pay me money, ^_^ Just kidding, No support whatsoever. If your questions are unanswered by the FILE_ID.txt, then i suggest not to use the script.
User Post (2005-04-22 02:20:36 by idorosen)
This is possible. All of the above posters are wrong or provide limited solutions! There are two popular ways I've seen this done -- either using mod_speling, or mod_rewrite...

I use mod_rewrite's RewriteMap functionality with the internal map "tolower" to create case insensitive URLs. You can do this as follows:

1. Convert ALL of your directories and files to have lowercase names only. (NO UPPERCASE, or else!)
2. Create an .htaccess file in your domain's root directory. For example, ~/example.com/.htaccess
3. In this .htaccess file paste the following:

RewriteEngine on
RewriteBase /
RewriteMap insensitive tolower:
RewriteRule ^[\/]*(.*)$ /${insensitive:$1} [R,L]

4. Try it out!

Notice that the above creates a mapping function using Apache's internal tolower() function, and applies it to the URL. If the mapping fails, since there is no default value provided, the URL redirection will default to /... The redirection above is opaque -- the browser is externally redirected, rather than an internal rewriting; remove the [R,L] part to make the redirection transparent, even if it means your users will bookmark the wrong case.

More information about mod_rewrite is available at this URL:
http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteMap
User Post (2003-03-13 22:03:16 by theraven)
You can also use ln FileName.html filename.html for files...
User Post (2001-06-12 00:09:06 by tefen)
personally I like making links.

Take the following example, you've got mydomain.com/Photography/ and want people to be able to hit
mydowmain.com/photography/ as well...

Fire up the shell,
go to the proper directory
type ln -s Photography photography

This creates a symbolic link to the directory, now the lowercase one essentially redirects (internally) to the uppercase one.