2

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
2
  • What is the complete url your typing in browser's location bar? Commented Jul 31, 2015 at 10:24
  • [www.example.com/player-score.php?id=1&card=45] and the card value shows 45.php Commented Jul 31, 2015 at 10:24

3 Answers 3

1

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]
Sign up to request clarification or add additional context in comments.

Comments

0

Try this rule :

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

1 Comment

Are you using .php in the end /player_score/1/45.php?
0

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]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.