Codeigniter - best routes configuration for CMS?

后端 未结 2 908
谎友^
谎友^ 2021-02-06 17:48

I would like to create a custom CMS within Codeigniter, and I need a mechanism to route general pages to a default controller - for instance:

mydomain.com/about
         


        
2条回答
  •  终归单人心
    2021-02-06 18:45

    If you use CodeIgniter 2.0 (which has been stable enough to use for months) then you can use:

    $route['404_override'] = 'pages';
    

    This will send anything that isn't a controller, method or valid route to your pages controller. Then you can use whatever PHP you like to either show the page or show a much nicer 404 page.

    Read me guide explaining how you upgrade to CodeIgniter 2.0. Also, you might be interested in using an existing CMS such as PyroCMS which is now nearing the final v1.0 and has a massive following.

提交回复
热议问题