2013-06-24 70 views
0

例:當有人訪問這個URL的.htaccess:想查詢字符串添加到301重定向到相同的URL

http://example.com/site/register

我想自動加入這個查詢字符串:

http://example.com/site/register?destination=thankyou

我在我的.htaccess文件中試過以下內容:

重定向301/site/register/site/register?destina tion =謝謝

但是,這創建了一個無限的重定向循環。

我已經抓取網絡幾個小時的解決方案,但無濟於事。提前致謝。

+0

糾正我,如果我錯了,但你趕上所有請求'/網站/ register',然後期待'/站點的請求/ register'不被捕獲?這是無法工作的。也許可以使用PHP或者只是重定向到'/ site/register_thanks_message?...'或其他東西 – nonchip

回答

0

如果register是PHP,使用類似:

<?php 
    if(!array_key_exists('destination',$_GET)) 
    header('Location: '.http_build_query(
     array_merge($_GET,array('destination'=>'thankyou'))); 
相關問題