1

我需要将所有 url 重写为小写,但我无权访问 httpd.conf 来添加 RewriteMap。有没有办法在没有 RewriteMap 的情况下将 .htaccess 重写为小写?我尝试过的当前代码正在产生内部错误/500

#RewriteEngine On
#RewriteMap lowercase int:tolower
#RewriteCond $1 [A-Z]
#RewriteRule ^/(.*)$ /${lowercase:$1} [R=303,L]

RewriteEngine On
RewriteMap  lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
4

2 回答 2

0

这对我有用。

Options +FollowSymlinks
RewriteEngine On
CheckSpelling On
CheckCaseOnly On
于 2012-08-17T15:33:18.370 回答
0
RewriteRule "(.*)A(.*)" "$1a$2" [N,R]
RewriteRule "(.*)B(.*)" "$1b$2" [N,R]
RewriteRule "(.*)C(.*)" "$1c$2" [N,R]
RewriteRule "(.*)D(.*)" "$1d$2" [N,R]
RewriteRule "(.*)E(.*)" "$1e$2" [N,R]
RewriteRule "(.*)F(.*)" "$1f$2" [N,R]
RewriteRule "(.*)G(.*)" "$1g$2" [N,R]
RewriteRule "(.*)H(.*)" "$1h$2" [N,R]
RewriteRule "(.*)I(.*)" "$1i$2" [N,R]
RewriteRule "(.*)J(.*)" "$1j$2" [N,R]
RewriteRule "(.*)K(.*)" "$1k$2" [N,R]
RewriteRule "(.*)L(.*)" "$1l$2" [N,R]
RewriteRule "(.*)M(.*)" "$1m$2" [N,R]
RewriteRule "(.*)N(.*)" "$1n$2" [N,R]
RewriteRule "(.*)O(.*)" "$1o$2" [N,R]
RewriteRule "(.*)P(.*)" "$1p$2" [N,R]
RewriteRule "(.*)Q(.*)" "$1q$2" [N,R]
RewriteRule "(.*)R(.*)" "$1r$2" [N,R]
RewriteRule "(.*)S(.*)" "$1s$2" [N,R]
RewriteRule "(.*)T(.*)" "$1t$2" [N,R]
RewriteRule "(.*)U(.*)" "$1u$2" [N,R]
RewriteRule "(.*)V(.*)" "$1v$2" [N,R]
RewriteRule "(.*)W(.*)" "$1w$2" [N,R]
RewriteRule "(.*)X(.*)" "$1x$2" [N,R]
RewriteRule "(.*)Y(.*)" "$1y$2" [N,R]
RewriteRule "(.*)Z(.*)" "$1z$2" [N,R]
于 2016-12-03T13:05:11.047 回答