Apparently, my .htaccess rewrite eats up all $_GET-variables on my page:
When accessing the URL http://192.168.1.1/welcome/test?getvar=true and running var_dump($_GET) in my index.php file, I get this this output:
array '/welcome/test' => string '' (length=0) So no $_GET-data available and no sign of the getvar-variable from my URL.
Here's my .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] What should I change to ensure that my rewrite is working as intended but $_GET-variables still are accessible?
You need the "QueryString Append" option:
RewriteRule ^(.*)$ index.php?route=/$1 [QSA,L]
Edit: Added @DonSeba's contribution, because it is correct.
minor detail change :
RewriteRule ^(.*)$ index.php?/$1 [L] to
RewriteRule ^(.*)$ index.php?route=$1 [QSA,L] now all routes will be visible in $_GET["route"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With