huddds
huddds

Reputation: 1045

PHP get value showing .php from url rewrite

I've used a url rewrite in the htaccess file to show 2 query string values as /item1/item2

When I get item2 it has .php at the end. Is there something I'm missing on my rewrite?

Get call

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

Rewrite

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

Fully example URL

www.example.com/player-score.php?id=1&card=45

Upvotes: 2

Views: 135

Answers (3)

huddds
huddds

Reputation: 1045

I found the issue, I need to move the rule below underneath my query string rewrite rule:

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

Upvotes: 1

Arun Krish
Arun Krish

Reputation: 2153

Can you try this. I have made minor edit to your rewrite.

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

Upvotes: 0

Amit Verma
Amit Verma

Reputation: 41219

Try this rule :

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

Upvotes: 0

Related Questions