问题
I want to use codeigniter framework for my project but I dont want it readable, so i have to encrypt url like:
http://myproject.com/index.php/indexcontroller/myaction/
into:
http://myproject.com/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw
I dont know how to achieve such scenario. How controller and methods will be called and how it will be performed. Please guide me.
回答1:
This sounds like a job for URI routing!
Add this to your config/routes.php
:
$route['(:any)'] = "MyController/MyFunc/$1";
Now when you go to:
http://myproject.com/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw
it will be "redirected" to:
http://myproject.com/MyController/MyFunc/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw
From there, you can "decode" the URL, and redirect to where you want to go.
回答2:
you can solve this problem by play with: application/config/routes.php
$route['(:any)'] = "controller/myaction/$1";
for more information URI Routing documination
来源:https://stackoverflow.com/questions/10623374/codeigniter-with-encrypted-urls