php - GET Variable lost on RewriteRule

I have written a redirect to change quiz.php?quiz=1 to /quiz/1 however PHP can no longer pickup the GET Variables, is there anything i'm missing? This is my htaccess file:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^quiz/([^/]*)$ /quiz.php?quiz=/$1 [QSA,L]
Answer
Solution:
You have error in RewriteRule ^quiz/([^/]*)$ /quiz.php?quiz=/$1 [QSA,L] There should not be slash at redirect target, so correct is
RewriteRule ^quiz/([^/]*)$ /quiz.php?quiz=$1 [QSA,L]
I tried this on localhost and it is working properly. Try debugging via e.g. var_dump($_GET);
Answer
Solution:
In this specific case, you probably need to disable content negociation andAcceptPathInfo
features by adding the following lines to your .htaccess file:
AcceptPathInfo off
Options -MultiViews
Content negociation can internally "rewrite" "quiz" into "quiz.php". AndAcceptPathInfo
"quiz.php/a/b/c" to "quiz.php" with$_SERVER['PATH_INFO']
= '/a/bc/c'. They both happen before rewriting, bypassing your rule.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: your lock file does not contain a compatible set of packages. please run composer update
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.