簡體   English   中英

多查詢字符串.htaccess重定向

[英]Multipule Query Strings .htaccess Redirect

我有點卡住了,我需要重定向80個以上的網址

 content.php?111-rest-of-url 

 RewriteCond %{QUERY_STRING} ^?64-random-url-here-again$
 RewriteRule ^content.php$ https://www.newdomain.com/random-url-here-again/? [R=301,L,QSD]

 RewriteCond %{QUERY_STRING} ^?61-random-url-here$
 RewriteRule ^content.php$ https://www.newdomain.com/random-url-here/? [R=301,L,QSD]

大約還有80個這樣寫的網址。 但是,在現場進行測試時,無論您嘗試使用哪種URL,它始終會返回.htaccess中的第一個

從我一直在閱讀的內容中,我可以假設您只能使用一個這樣的查詢字符串嗎? 如果可以的話,這附近有沒有?

提前致謝。

好的,所以我設法完成了以下工作,希望可以對其他人有所幫助。

RewriteCond %{REQUEST_URI}  ^/content\.php$
RewriteCond %{QUERY_STRING} ^196-random-url-here-again$
RewriteRule ^(.*)$ https://www.newdomain.com/random-url-here-again/? [R=301,L,QSD]

RewriteCond %{REQUEST_URI}  ^/content\.php$
RewriteCond %{QUERY_STRING} ^196-random-url-here$
RewriteRule ^(.*)$ https://www.newdomain.com/random-url-here/? [R=301,L,QSD]

不知道區別是什么,但它是否有效:),不勝感激,希望有人能解釋我所做的區別,以便將來理解。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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