我试图改变
http://localhost/archives?key=[uncicode string]
到
http://localhost/archives/[uncicode string]
例如
http://localhost/archives?key=سلdf
到
http://localhost/archives/سلdf
我该怎么做?
RewriteRule ^archives\/([.*]+)$ archives?key=$1
有什么问题?
答案 0 :(得分:1)
尝试此规则:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+archives\?key=([^\s&]+) [NC]
RewriteRule ^ /archives/%1? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^archives/([^/]+)/?$ /archives?key=$1 [L,B,NE,QSA]