[英]Redirection with Apache2 query_string with square brackets
I have a URL like 我有一个类似的网址
http://domain.net/documents?f[author]=43
Which should be redirected to 应该重定向到
http://domain.net/documents/author/43
What I have so far is 我到目前为止所拥有的是
RewriteEngine On
Rewritebase /documents
RewriteCond %{query_string} f([^/]+)=(.*)$ [NC]
RewriteRule (.*) author/%2? [R=301,L]
However, this redirects all URLs, including http://domain.net/documents/author/43?page=1 back to http://domain.net/documents/author/43 when I just need to replace the "?f[author]=" part with "/author/" 但是,当我只需要替换“?f”时,这会将包括http://domain.net/documents/author/43?page=1在内的所有URL重定向回http://domain.net/documents/author/43 。 [author] =“部分带有” / author /“
RewriteEngine On
Rewritebase /documents
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteCond %{query_string} f([^/]+)=(.*)$ [NC]
RewriteRule (.*) author/%2? [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.