2012-08-17 36 views
1

我需要重寫所有URL爲小寫,但我沒有訪問httpd.conf添加RewriteMap。有沒有辦法做.htaccess重寫爲小寫沒有RewriteMap?目前我試過的代碼是產生內部錯誤/ 500htaccess小寫沒有RewriteMap

#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] 

回答

0

這對我有效。

Options +FollowSymlinks 
RewriteEngine On 
CheckSpelling On 
CheckCaseOnly On 
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]