Redirect everything to index.php HTACCESS

Asked

Viewed 487 times

0

I have a website that redirects everything to index.php using htaccess using that code

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1

and from the index I take the value passed by the URL and use the function explodes to separates everything by the bar and validate the data and redirect to the pages until all right just that I can not receive data by the Get in this way

http://www.site.com/autos-e-pecas/?val_min=&val_max=

when I echo the URL comes as follows

http://www.site.com/autos-e-pecas/

and I can’t get the data I think is due by redirecting it in htaccess

1 answer

2


I don’t quite understand the problem, I don’t know how you’re trying to get the GET, but I think the flag is missing [QSA], being like this:

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA]
  • 1

    was exactly what was missing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.