htaccess重定向删除特殊字符

时间:2012-05-28 02:33:01

标签: .htaccess mod-rewrite redirect url-rewriting

我想将此网址http://www.domain.com/forum/1122554-lorem-ipsum-u-dolor%C4%8Dsimit-lorem重定向到http://www.domain.com/forum/1122554-lorem-ipsum-u-dolorsimit-lorem

我试过了:

%C4%8D == č
RewriteRule ^forum/(.+)(č)(.+) /forum/$1$3 [R=301,L]
this also not worked
RewriteRule ^forum/(.+)(%C4%8D)(.+) /forum/$1$3 [R=301,L]

但它不起作用。

2 个答案:

答案 0 :(得分:0)

RewriteRule ^forum/(.*)([^a-zA-Z0-9-./]+)(.*) /forum/$1$3 [R=301,L]

答案 1 :(得分:0)

这是正确答案,对不起伙计们,我已经弄明白了!我希望这对其他人也有帮助!     ^ / forum /(.*)(?:% C4%8D |č)/ forum / $ 1