Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GET parameters cant retrieve using php

I'm working on a php page which can't retrieve the GET parameter values from the browser url

ex- if i pass below url via browser

http://www.test.com/afvalbakken?price[]=&price[]=&17[]=&17[]=&16[]=107&18[]=180

the var_dump($_GET) the output below array.and it not shows the parameters passed

array(1) {
  ["url"]=>
  string(11) "afvalbakken"
}

i use a htaccess file for some url rewrite.below has its codes

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?url=$1 [L]

anyone know how to access those get parameters please, thank you

like image 557
Salinda Bandara Avatar asked Sep 04 '26 06:09

Salinda Bandara


1 Answers

You need QSA flag here:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?url=$1 [L,QSA]

QSA (Query String Append) flag preserves existing query parameters when you are adding a new one.

like image 82
anubhava Avatar answered Sep 06 '26 20:09

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!