找到了这个,但我想要查询完成的字符串。
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+profile\.php\?u=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ profile.php?u=$1 [L,QSA]
答案 0 :(得分:0)
为2个参数添加新的重定向和重写规则:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+profile\.php\?u=([^\s&]+)&name=([^\s&]+) [NC]
RewriteRule ^ /%1/%2? [R=302,L]
RewriteCond %{THE_REQUEST} \s/+profile\.php\?u=([^\s&]+)\s [NC]
RewriteRule ^ /%1? [R=302,L]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/?$ profile.php?u=$1&name=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ profile.php?u=$1 [L,QSA]