Reputation: 157
I am trying to add a redirect to .htaccess as follows:
RewriteRule ^resources/reports /resources?f[0]=field_resource_type%3Areports [R=301,L]
However, it is rewritten as resources?f%5b0%5d=field_resource_typeAreports which doesn't work. The [ and ] characters are encoded when they don't need to be, and the %3A seems to get lost.
If I copy-paste the exact replacement string into the browser then it has no problem, but I can't seem to add a RewriteRule to do it.
I have tried adding [B] and [NE] but they don't seem to make any difference.
Anyone had to do this before?
Upvotes: 2
Views: 229
Reputation: 785186
You need to:
%
in target otherwise %3
will be treated as back-referenceNE
(non encoded) flagUse this rule:
RewriteRule ^resources/reports /resources?f[0]=field_resource_type\%3Areports [R=301,L,NE]
Test this after clearing your browser cache.
Upvotes: 2