Home » Php » php – htaccess – rewrite path to get param

php – htaccess – rewrite path to get param

Posted by: admin February 25, 2020 Leave a comment

Questions:

I want to rewrite url example.com/callback/ or example.com/callback so that PHP thinks it isexample.com/?callback.

Trying this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} callback
RewriteRule ^(.*)$ /index.php?callback [L]

I see $_GET['callback'] = "" but also $_SERVER['REQUEST_URI'] = "/callback".

How to remove the path?

How to&Answers: