使用htaccess在搜索网址中允许使用特殊字符

时间:2016-10-29 17:45:17

标签: php apache .htaccess redirect mod-rewrite

我试图找到答案,但没有成功。

当我搜索Mädchen时,我会收到以下网址:

http://www.example.com/search/M%25C3%25A4dchen,我怎样才能获得这样的网址:

http://www.example.com/search/Mädchen

这是我的htaccess:

RewriteRule "^(search)/([^+]*)\++([^+]*\+.*)$" /$1/$2-$3 [L,NC]

RewriteRule "^(search)/([^+]*)\+([^+]*)$" /$1/$2-$3 [L,R=301,NE,NC]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^search/([^/.]+)$ /search.php?key=$1 [QSA,L]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+search\.php\?key=([^\s]+) [NC]

RewriteRule ^ /search/%1? [R=301,L]\

0 个答案:

没有答案