大写网址转换为小写而不是图片网址

时间:2018-08-06 09:51:28

标签: php wordpress .htaccess

我正在尝试将大写url转换为小写及其工作。但是图像未显示,正在保存大写字母。

请更正我的代码。

# BEGIN Caps Redirect by ServeU.net 
# If there are caps, set HASCAPS to true and skip next rule 
RewriteRule [A-Z] - [E=HASCAPS:TRUE,S=1] 
# Skip this entire section if no uppercase letters in requested URL
RewriteRule ![A-Z] - [S=28] 
# Replace single occurance of CAP with cap, then process next Rule. 
RewriteRule ^([^A]*)A(.*)$ $1a$2 [DPI] RewriteRule ^([^B]*)B(.*)$ $1b$2 [DPI] 
RewriteRule ^([^C]*)C(.*)$ $1c$2 [DPI] RewriteRule ^([^D]*)D(.*)$ $1d$2 [DPI] 
RewriteRule ^([^E]*)E(.*)$ $1e$2 [DPI] RewriteRule ^([^F]*)F(.*)$ $1f$2 [DPI] 
RewriteRule ^([^G]*)G(.*)$ $1g$2 [DPI] RewriteRule ^([^H]*)H(.*)$ $1h$2 [DPI] 
RewriteRule ^([^I]*)I(.*)$ $1i$2 [DPI] RewriteRule ^([^J]*)J(.*)$ $1j$2 [DPI] 
RewriteRule ^([^K]*)K(.*)$ $1k$2 [DPI] RewriteRule ^([^L]*)L(.*)$ $1l$2 [DPI] 
RewriteRule ^([^M]*)M(.*)$ $1m$2 [DPI] RewriteRule ^([^N]*)N(.*)$ $1n$2 [DPI] 
RewriteRule ^([^O]*)O(.*)$ $1o$2 [DPI] RewriteRule ^([^P]*)P(.*)$ $1p$2 [DPI] 
RewriteRule ^([^Q]*)Q(.*)$ $1q$2 [DPI] RewriteRule ^([^R]*)R(.*)$ $1r$2 [DPI] 
RewriteRule ^([^S]*)S(.*)$ $1s$2 [DPI] RewriteRule ^([^T]*)T(.*)$ $1t$2 [DPI] 
RewriteRule ^([^U]*)U(.*)$ $1u$2 [DPI] RewriteRule ^([^V]*)V(.*)$ $1v$2 [DPI] 
RewriteRule ^([^W]*)W(.*)$ $1w$2 [DPI] RewriteRule ^([^X]*)X(.*)$ $1x$2 [DPI] 
RewriteRule ^([^Y]*)Y(.*)$ $1y$2 [DPI] RewriteRule ^([^Z]*)Z(.*)$ $1z$2 [DPI] 
# If there are any uppercase letters, restart at very first RewriteRule in file. 
RewriteRule [A-Z] - [N] 
RewriteCond %{ENV:HASCAPS} TRUE RewriteRule ^/?(.*) /$1 [R,L] 
# END Caps Redirect by ServeU.net

1 个答案:

答案 0 :(得分:0)

将此规则放在RewriteEngine On行的顶部,即跳过所有已知图像扩展名的规则:

RewriteEngine On

RewriteRule \.(?:jpe?g|gif|bmp|png|ico|tiff|css|js)$ - [L,NC]

# remaining rules go below this line