如何在Linux服务器中使URL不区分大小写?
如果我输入网址localhost:80/tom/Read
或../READ
或/read
需要导航到一个内部read
文件夹。
我在根目录下创建了一个.htaccess文件。将以下代码放置在文件的下面 :
RewriteEngine On
RewriteBase /tom/
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ![A-Z] - [S=26]
RewriteRule ^(.*)(A)(.*)$ $1a$3 [N,R=301]
RewriteRule ^(.*)(B)(.*)$ $1b$3 [N,R=301]
RewriteRule ^(.*)(C)(.*)$ $1c$3 [N,R=301]
RewriteRule ^(.*)(D)(.*)$ $1d$3 [N,R=301]
RewriteRule ^(.*)(E)(.*)$ $1e$3 [N,R=301]
RewriteRule ^(.*)(F)(.*)$ $1f$3 [N,R=301]
RewriteRule ^(.*)(G)(.*)$ $1g$3 [N,R=301]
RewriteRule ^(.*)(H)(.*)$ $1h$3 [N,R=301]
RewriteRule ^(.*)(I)(.*)$ $1i$3 [N,R=301]
RewriteRule ^(.*)(J)(.*)$ $1j$3 [N,R=301]
RewriteRule ^(.*)(K)(.*)$ $1k$3 [N,R=301]
RewriteRule ^(.*)(L)(.*)$ $1l$3 [N,R=301]
RewriteRule ^(.*)(M)(.*)$ $1m$3 [N,R=301]
RewriteRule ^(.*)(N)(.*)$ $1n$3 [N,R=301]
RewriteRule ^(.*)(O)(.*)$ $1o$3 [N,R=301]
RewriteRule ^(.*)(P)(.*)$ $1p$3 [N,R=301]
RewriteRule ^(.*)(Q)(.*)$ $1q$3 [N,R=301]
RewriteRule ^(.*)(R)(.*)$ $1r$3 [N,R=301]
RewriteRule ^(.*)(S)(.*)$ $1s$3 [N,R=301]
RewriteRule ^(.*)(T)(.*)$ $1t$3 [N,R=301]
RewriteRule ^(.*)(U)(.*)$ $1u$3 [N,R=301]
RewriteRule ^(.*)(V)(.*)$ $1v$3 [N,R=301]
RewriteRule ^(.*)(W)(.*)$ $1w$3 [N,R=301]
RewriteRule ^(.*)(X)(.*)$ $1x$3 [N,R=301]
RewriteRule ^(.*)(Y)(.*)$ $1y$3 [N,R=301]
RewriteRule ^(.*)(Z)(.*)$ $1z$3 [N,R=301]
mod_speling将位于Linux服务器中的什么位置?
写回答邀请回答
提问于 2018-03-152018-03-15 08:17:42
用户回答回答于 2018-03-152018-03-15 16:56:25
通过使用mod_speling模块,你可以轻松地使apache web服务器忽略该案例:
CheckSpelling On
CheckCaseOnly On
通过使用mod_speling模块,你可以轻松地使apache web服务器忽略该案例: CheckSpelling On CheckCaseOnly On
用户回答回答于 2018-03-152018-03-15 17:52:01
我最终得到了解决方案。放置在下面的代码/etc/httpd/conf/httpd.conf:
LoadModule speling_module modules/mod_speling.so
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>
然后重启httpd:
sudo service httpd restart
最后验证它已启用:
sudo httpd -M | grep speling