开发者

CodeIgniter with less URL segments

开发者 https://www.devze.com 2023-02-13 17:39 出处:网络
As you might know, the URL for codeigniter is build like this. In my case, I have: http://example.com/subfolder/class/function/ID

As you might know, the URL for codeigniter is build like this. In my case, I have:

http://example.com/subfolder/class/function/ID

Is there a way with codeigniter (or htaccess) to create this url in a much shorter url like this:

http://exampl开发者_运维技巧e.com/ID

Kind regards, Senne


In the application/configs/routes.php file, you should be able to add something like this:

$routes['(:num)'] = 'your_controller/your_function/$1'

You can read more about custom routing here: http://codeigniter.com/user_guide/general/routing.html


You can do this by using Url Routing in CodeIgniter.

$route[':any'] = "subfolder/class/function/$1";
0

精彩评论

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