Douglas Roos
Douglas Roos

Reputation: 613

PHP Issues while sending form get with mod rewrite enabled

I have a search function to look up for products, also i have enabled the mod rewrite within the .htaccess

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^([A-Za-z0-9_-]+)$ /index.php?go=$1
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?go=$1&action=$2
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?go=$1&action=$2&do=$3
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?go=$1&action=$2&do=$3&id=$4

The thing is that when i do a search like https://www.server.com/search?search=try+search it doesn't show any results when doing:

echo $_GET['search'];

But if i do https://www.server.com/?go=search&search=try+search then it works perfectly, so i see that the problem is the rewrite but i can not fix it.

Any advice?

Thanks

Upvotes: 0

Views: 22

Answers (1)

tttony
tttony

Reputation: 5092

Try to add this to every rule: [QSA,L]

More info about the flags here: QSA, L

Upvotes: 1

Related Questions