Hanata Hanata -4 years ago 134
PHP Question

How to get all $_GET parameters with htaccess

I got a htaccess like:

RewriteEngine On
RewriteRule ^admin/$ admin/index.php [NC,L] # Handle product requests
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ index.php?p=$1&id=$2 [NC,L] # Handle product requests
RewriteRule ^([a-zA-Z0-9-]+)/?$ index.php?p=$1 [NC,L] # Handle product requests
RewriteRule ^$ index.php?p=index


But when i get URL like this:
site-mine.php/product/?soomething=anything

Then Php only realizes
product
as
$_GET
parameters.
I want to get all of it
$_GET
parameter.
could some help me?
Thanks

Answer Source

To pass the original query parameters to the rewritten url, you need the QSA flag:

RewriteRule     ^admin/$    admin/index.php     [NC,L,QSA]    # Handle product requests
                                                      ^^^ here
# etc.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download