簡體   English   中英

使用方括號將Apache2 query_string重定向

[英]Redirection with Apache2 query_string with square brackets

我有一個類似的網址

http://domain.net/documents?f[author]=43

應該重定向到

http://domain.net/documents/author/43

我到目前為止所擁有的是

RewriteEngine On    
Rewritebase /documents
RewriteCond %{query_string} f([^/]+)=(.*)$ [NC]
RewriteRule (.*) author/%2? [R=301,L]

但是,當我只需要替換“?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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM