Search code examples
codeignitercodeigniter-urlcodeigniter-routing

Create "Permalink" functionality in codeigniter


Recently i am working with codeigniter. I need to create a permalink functionality just like as wordpress. Can anyone suggest me a way that, how i can implement this in codeigniter.


Solution

  • Can you give more details about what you want to do. In my understanding you want to create something like this?

    http://example.com/2012/post-name/
    

    1) You must have a mod_rewrite. 2) Use the controller or model but will advice to use Controller

    Controller:

        public function something(string name, int year){
         //some code
       }
    

    This will be translated to

    http://www.example.com/something/name/year
    

    Hope this helps or you can paste your code so I can explain further.