Make Folders in Apache Case Insensitive using .htaccess

会有一股神秘感。 提交于 2019-12-06 07:52:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!