我有这个重新布线规则: 已编辑
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 :(得分:0)
RewriteRule ^ride/(.+)/?$ ride.php?myRideId=$1 [NC,L]
试试这个。您还需要将您的URL写为:
www.example.com/ride/123/