The current RewriteRule removes any query except query callback for any URL.
# Remove question mark and parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/ [NC]
# Query rewrite exceptions
##RewriteCond %{REQUEST_URI}?%{QUERY_STRING} !^/api.*?callback=.* #does not work
RewriteCond %{QUERY_STRING} !callback=
RewriteRule .*$ %{REQUEST_URI}? [R=301,L]
How to avoid query callback rewrite just from URL ^api\/?([^\/]*)$? Excepted result:
- no rewrite for /api?callback=1, /api/user?callback=1, /api/user/2?callback=1
- rewrite for /apis?callback=1, /user?callback=1, /api/user?foo=1 etc.
To enable
RewriteRulefor index.php, need to add in query rewrite exceptions.This rules works fine and fixes this issue: