.htaccess - RewriteRule that preserves GET parameters -


what wrong rewrite rule?

rewriterule ^api/(.+)$ api/index.php?url=$1 [l] 

i want "index.php?url=" added after api/ , before rest of parameters.

api/image/upload&arg1=1&text=lorem+ipsum 

to

api/index.php?url=image/upload&arg1=1&text=lorem+ipsum 

what wrong (.+) after api/?

the regex on rewriterule run against path part of url, not query parameters. fortunately there [qsa] flag preserve existing query parameters.


Comments