簡體   English   中英

.htaccess 302使用php參數將URL重定向到其他網站

[英].htaccess 302 redirect url with php parametr to other website

有人可以告訴我它是否可以正常工作嗎?

我需要重定向302個網頁:
http://www.mysite.domain.net/?click=url
http://www.mysite.domain.net/?url=anotherurl&version=1&reflink=base

到網頁http://othersite.otherdomain.com

RewriteEngine on
    RewriteCond %{QUERY_STRING} ^(.*&)?click=url$
    RewriteCond %{QUERY_STRING} ^(.*&)?url=program&version=1&reflink=base

    RewriteRule ^$http://othersite.otherdomain.com [L, NC]   
  • 您需要在RewriteCond行之間使用[OR]
  • 您的RewriteRule語法錯誤。
  • R標志前的空格將導致500。

嘗試以下規則:

RewriteEngine on

RewriteCond %{QUERY_STRING} (^|&)click=url(&|$) [OR]
RewriteCond %{QUERY_STRING} (^|&)url=program&version=1&reflink=base(&|$)
RewriteRule ^/?$ http://othersite.otherdomain.com/? [L,NC,R=302]   

暫無
暫無

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

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