I have URL with an encoded slash (%2F
) and I cannot get rewrite rules to catch this correctly.
My URL is:
http://example.com/some-path/description%2Frest-of-description/1101
I've tried rewrites like:-
# is the %2F interpreted as a path separator
RewriteRule ^some-path/(.*)/(.*)/(.*)$ /property/view?ref=$3 [B,R=301,L]
# or is it as an encoded string
RewriteRule ^some-path/(.*)%2F(.*)/(.*)$ /property/view?ref=$3 [B,R=301,L]
# or even double encoded
RewriteRule ^some-path/(.*)%252F(.*)/(.*)$ /villas/$1-$2/$3 [B,R=301,NE,L]
I've also tried adding QSA
to above.
There is a similar question on SO here but it's IIS and .NET based
I'm running LAMP stack