问题
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