问题
I need to make accessing directories on my server case insensitive.
How do I do that using htaccess?
回答1:
You have to install and enable the mod_speling module in apache and set the CheckCaseOnly Directive to On in your .htaccess
CheckCaseOnly On
回答2:
If you want requested URLs to be valid whether uppercase or lowercase letters are used, use mod_speling to make URLs case-insensitive. Write the following code in .htaccess file:
CheckSpelling On
回答3:
This is what I used because my hosting is shared and does not include the mod_spelling module but does support .htaccess, but this only works for one folder:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^student-government/$ http://www.tombarrasso.com/Student-Government/ [R=302,NC,L]
The folder to redirect to can be any case, so you could use lower-case folders and redirect all variations of spelling there.
I suppose it could be adapted with a little bit of REGEX to work for all folders rather than just one. This worked for me on Apache 2.2.14 (Unix).
来源:https://stackoverflow.com/questions/2021796/make-folders-in-apache-case-insensitive-using-htaccess