URL contain % ,%2f would be a / and the %3d a = In yii?

限于喜欢 提交于 2019-12-13 21:31:28

问题


My url in yii is:

http://localhost/php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG%2Fg0jJFWjiWWdPnkq5VDlY%3D

what should I have to do in url manager to get this,My current rule is:

'<controller:\w+>/ByCustomer/<giftcode>'=>'<controller>/ByCustomer',

Actually problem is that I get :

The requested URL     /php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG/g0jJFWjiWWdPnkq5VDlY= was     not found on this server.

It is due to %3D %2F in the URL.What I have to do to make it work fine?


回答1:


I know apache has problem with %2F in URL, it will always reply with 404, php script is not executed. I never found a way around it. But that was some years ago.

EDIT:

There's a solution, but it requires you can edit apache configuration file for your virtual host at least (I didn't have that at that time). Then you have to add AllowEncodedSlashes On inside your <VirtualHost>. Or you can also set it globaly.




回答2:


I got the solution of it,For that I have to change my encode and decode method:

function base64_url_encode($input) {
 return strtr(base64_encode($input), '+/=', '-_,');
}

function base64_url_decode($input) {
 return base64_decode(strtr($input, '-_,', '+/='));
} 

The problem was due to some characters which are there in encoded Url.So, I have to replace these characters.

These links Help me:

Stackoverflow

and

google Group



来源:https://stackoverflow.com/questions/25243714/url-contain-2f-would-be-a-and-the-3d-a-in-yii

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!