I've got a rewrite rule as following,it's working:
RewriteRule area/(.*) listing.php?area=$1
However when I wish to use
%29 inside it,however when I rewrite it as being following, I recieve 404 error:
RewriteRule area/something%29/(.*)/ listing.php?area=$1
\%29 also not works.
Apache %-decodes the url-path prior to trying to use the rewrite rules. So you shouldn't use %-encoding inside your RewriteRule. Only use the standard character.
So inside your situation you need to only use the
) however is really a special character in regular expression, which means you should escape individuals within the RegEx way with the addition of a slash in-front. So it is
Your rule above should become:
RewriteRule area/something\)/(.*)/ listing.php?area=$1
The URL you need to rewrite is invalid as %29 would simply be permitted inside a Querystring, not really a URL. You have to escape the % as %25 (and never having a backslash), therefore the resulting expression could be ...something%2529 - that ought to work.
For additional thorough information check RFC2396.