PHP从url重写获取值showing.PHP

PHP从url重写获取值showing.PHP,php,.htaccess,url-rewriting,query-string,Php,.htaccess,Url Rewriting,Query String,我在htaccess文件中使用了url重写,将2个查询字符串值显示为/item1/item2 当我得到item2时,它的末尾有.php。我的重写有什么遗漏吗 接到电话 $card = $_GET['card']; $card; // This value has .php after the value 重写 RewriteRule ^player-score\/([^\/]+)\/([^\/]+)\/? /player-score.php?id=$1&card=$2 [QSA,NC

我在htaccess文件中使用了url重写,将2个查询字符串值显示为/item1/item2

当我得到item2时,它的末尾有.php。我的重写有什么遗漏吗

接到电话

$card = $_GET['card'];
$card; // This value has .php after the value
重写

RewriteRule ^player-score\/([^\/]+)\/([^\/]+)\/?  /player-score.php?id=$1&card=$2 [QSA,NC,L]
完整示例URL

www.example.com/player-score.php?id=1&card=45
试试这个规则:

RewriteRule ^player-score/([^\/]+)/([^/.]+)/?$  /player-score.php?id=$1&card=$2 [QSA,NC,L]

你能试试这个吗。我对你的重写作了小修改

RewriteRule ^player-score/([^/.]+)/([^/.]+)/?$  player-score.php?id=$1&card=$2 [QSA,NC,L]

我发现了问题,我需要将下面的规则移到我的查询字符串重写规则下面:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

您在浏览器位置栏中键入的完整url是什么?[www.example.com/player score.php?id=1&card=45],并且卡片值显示为45.phpAre您是否在end/player\u score/1/45.php中使用.php?