2014-01-30 59 views
0

我有這個聯控規則奇怪的現象:EDITED

RewriteRule ^(.*)$ $1.php [NC]// the problem is caused by this. How can I keep it without having this result? 
RewriteRule ^user/(.*)$ user.php?user=$1 [NC]  
RewriteRule ^ride/(.+)/$ ride.php?myRideId=$1 [NC,L] 

當我這樣做:

www.example.com/ride/123 

一切正常,我的瀏覽器中正確顯示但如果我嘗試使用:

$rideId = $_GET['myRideId']; 
    echo $rideId; 

結果是:

123.php/123 

我不明白爲什麼。重寫規則中有任何錯誤?

+0

print_r($ _ GET);給你結果? –

+0

@MihirChhatre陣列([myRideId] => 123.php/123) – mat

回答

0

您是否嘗試過這樣做呢?

RewriteRule ^ride/(.+)/?$ ride.php?myRideId=$1 [NC,L] 

試試這個。你也需要寫你的URL爲:

www.example.com/ride/123/ 
+0

如果我這樣做:www.example /騎/ 123/I 123獲得/ .PHP/123 /否則我仍然獲得與www.example上述結果/騎/ 123(也與新規則) – mat

+0

如何: 重寫規則^騎/(.+)/$ ride.php myRideId = $ 1 [NC,L] –

+0

對不起,我應該已經發布的所有重寫規則?這將有助於找到解決方案。問題是RewriteRule ^(。*)$ $ 1.php [NC] 這是所有其他規則之前。我將編輯我的問題。有沒有辦法保持這個規則而沒有這個結果? – mat