1

I have a problem with .htaccess not forwarding the GET/POST parameters..

Here's my .htaccess :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteRule .* index.php?a=%1&b=%2 [L]

But when I do something like :

mywebsite.com/url1/url2?action=delete&id=2

It redirects me to :

mywebsite.com/index.php?a=url1&b=url2

so it deletes the action=delete&id=2 and I have nothing in $_GET, is there any way to do that?

Thanks in advance.

  • And how should be the query after `index.php`? – Felipe Alameda A Jan 06 '13 at 12:35
  • Have you tried [this](http://stackoverflow.com/questions/4638678/redirect-post-htaccess) or [this](http://stackoverflow.com/questions/358263/htaccess-is-it-possible-to-redirect-post-data)? – nakib Jan 06 '13 at 12:35

1 Answers1

2

Use QSA (as in Query String Append)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteRule .* index.php?a=%1&b=%2 [L,QSA]
Gerben
  • 16,747
  • 6
  • 37
  • 56