更新时间:2023-11-07 23:21:04
这应该可以解决问题:
重写引擎开启
## Redirect to pretty urls
# The '%1' in the rewrite comes from the group in the previous RewriteCond
RewriteCond %{REQUEST_URI} !seo
RewriteCond %{QUERY_STRING} ^size=large&colour=green&pattern=([a-zA-Z]*)$
RewriteRule (.*) /directory/seo/%1/? [L,R=301]
## Rewrite to long url, additional parameter at the end will cause
## the internal redirect not to match the previous rule (would cause redirect loop)
RewriteRule ^directory/seo/([^/]*)/$ /directory/script.php? size=large&colour=green&pattern=$1&rewrite [L]
如果需要,您还可以匹配大小和颜色,将它们也更改为正则表达式组,并使用相应的 %N
You can also match the size and colour if needed, by changing those to regex groups as well, and using the corresponding %N
希望这会有所帮助.