Having a bit of an issue with an apache rewriterule I’ve created. Code is
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{REQUEST_URI} new$
RewriteRule ^/json/([a-z0-9]+)/([a-z0-9\/]+)$ /json.php?api=$1&qs=$2&refresh=true [NC,L]
RewriteRule ^/json/([a-z0-9]+)/([a-z0-9\/]+)$ /json.php?api=$1&qs=$2 [NC,L]
The second back reference “qs” will retain the “new” parameter, but I want to remove it from the querystring passed to json.php. Obviously, I could do this server side in PHP, but I’d like to keep it as neat and tidy as possible, and potentially add more parameters on the RewriteRule which Id like to exclude from the qs param.
Anyone got any ideas?
You should be able to do this by modifying the regex in the rewrite rule, such that “new” is included outside of the group: