I’m trying to add a new external/non-WP rewrite rule to my .htaccess
but WP keeps adding [QSA,L]
to the end of the rule.
How do I prevent the QSA part?
This line adds the RewriteRule:
$wp_rewrite->add_external_rule('go/([0-9]+)/?.*$', 'wp-content/plugins/xswpc/redirect.php?id=$1');
And this is the resulting line in my .htaccess
RewriteRule ^go/([0-9]+)/?.*$ /wp-content/plugins/xswpc/redirect.php?id=$1 [QSA,L]
What I’d like is:
RewriteRule ^go/([0-9]+)/?.*$ /wp-content/plugins/xswpc/redirect.php?id=$1 [L]
The apache rewrite flags like
QSA
are hard coded, see source. Not sure why it would bother you, but if you really want to change it, then you can and should use themod_rewrite_rules
hook for that. Below an example on how to do it:Beware I haven’t tested the Regex.
Maybe you can try with add_rewrite_rule