CodeIgniter Forums
Routing Help Needed - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: Routing Help Needed (/thread-66760.html)

Routing Help Needed - codeigniterd - 11-28-2016

My URL now showing like this..
for a blog post

how can i make it look like this..

Thanks in advance ? Actually i am little wondered how developer achieve this in blog post.

RE: Routing Help Needed - Martin7483 - 11-29-2016

First, I would not use this date format (YYYY/MM/DD) in an URL. That format would result in 5 URI segments being set. Use YYYY-MM-DD instead. That will leave you with 3 segments.

If you have a controller named Blog, add the _remap method. Check out the documentation on that.

_remap documentation

In short, the second segment in your URL will be passed as an argument, and you can then check it, and remap it to any method within your controller.

If your index method shows a list of all your blogs you could have a method get_blog($date, $blog_title) for getting that specific blog entry.

PHP Code:
public function _remap($method) {
   ifmethod_exists($this$method) ) {
   } else {

Hope this gets you on your way

- Martin

RE: Routing Help Needed - codeigniterd - 11-29-2016