开发者

problem in decoding htaccess url rewrite values

开发者 https://www.devze.com 2023-01-06 07:15 出处:网络
i have written a code in .htaccess RewriteEngine on RewriteRule ^category-search/(.*)$ category-search.php?cat_id=$1

i have written a code in .htaccess

RewriteEngine on
RewriteRule ^category-search/(.*)$ category-search.php?cat_id=$1

and my current URL is

www.mydomain.com/category-search/=NA==

Last values (=NA==) is encoded in base64_encode. But when i m trying to fetch this values in php like...

$val=mysql_real_escape_string(base64_decode($_REQUEST['cat_id']));

I am getting $val equal to 开发者_JS百科nothing. What is error behind this ?

When i was not rewrite in htaccess this was working well.


=NA== is not a valid base64-encoded string (wrong length and invalid character at the beginning). Did you mean NA64==? That decodes to 4.

In case of =NA==, base64_decode() would return false, which outputs as empty string.


shouldn't you be looking at $_REQUEST['cat_id'] instead of $_REQUEST['sub_cat_id'] as that is what you have called the request parameter in the .htaccess file...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号