Forum Moderators: phranque

Message Too Old, No Replies

Special characters problem in URL

special characters in mod rewrite

         

tabish

4:11 pm on Jun 15, 2006 (gmt 0)

10+ Year Member



Hi,

Does anyone knows how to deal with special Characters and characters like %36 , %2F , &, $ # and many characters like that. My .htaccess code is below and right now it can deal only with numeric and alphabets:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /test/
RewriteRule ^([0-9¦a-zA-Z_]+)$ /test/$1/
RewriteRule ^([0-9¦a-zA-Z_]+)/$ index.php?keyword=$1

Please help me.

Regards
Tabish

jdMorgan

6:10 pm on Jun 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The special (%-encoded) characters should be unencoded by the time RewriteRule sees them.

So, for example, %2f will be seen as "/". and %36 as 6".

The unencoded values will remain avaialable in the %{THE_REQUEST} variable, testable by RewriteCond.

Characters such as "&" and "?", are invalid in a URL -- They can be present in a query string appended to a URL, but may not appear in the URL itself. Therefore, you must use RewriteCond %{QUERY_STRING} to test and manipulate those query parameters.

JIm