Home Apache: NE Flag (no escape) Not Working in RewriteRule of mod_rewrite
Reply: 0

Apache: NE Flag (no escape) Not Working in RewriteRule of mod_rewrite

user1157
1#
user1157 Published in May 27, 2018, 3:38 am

I have a URL like this:

http://www.sample.com/do/example/v1/abcd

I want to redirect it to:

http://sub.sample.com/some/test/do/example/v1/abcd

So I create an .htaccess file and using RewriteRule to do this:

RewriteCond %{HTTP_HOST} ^(www\.)?sample\.com$
RewriteCond %{REQUEST_URI} ^/do/(.*)$
RewriteRule ^(.*) http://sub.sample.com/some/test/do/%1

Everything works fine until the "abcd" is change to "PjX7%2Bj69" that has the %2B escaped character. So with this URL:

http://www.sample.com/do/example/v1/PjX7%2Bj69

I get:

404 Not Found | The requested URL do/example/v1/PjX7+j69 was not found on this server.

As we notice, the Apache changes the "PjX7%2Bj69" parameter to "PjX7+j69". So I use the NE Flag to disable the decoding:

RewriteRule ^(.*) http://sub.sample.com/some/test/do/%1 [NE]

But it is not working.

How can I prevent Apache URL decoding?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308803 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO