Reputation: 1984
I'm trying to rewrite a url such as:
example.com/var?id=0&blah=foo
to
example.com/?test=var&id=0&blah=foo
AddHandler application/x-httpd-php5s .php
RewriteEngine on
RewriteRule ^([A-Za-z0-9-]+)/?$ ?api_call=$1 [L,QSA]
Which rewrites var
into ?test=var
but the remaining get variables are left off.
Upvotes: 1
Views: 43
Reputation: 785196
Try this rule:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/?$ ?api_call=$1 [L,QSA]
Upvotes: 1