![]() |
Seo friendly url - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Seo friendly url (/showthread.php?tid=70366) |
Seo friendly url - cvlancvlan - 03-31-2018 I'm beginner in codeigniter and i try obtain seo friendly url for may project. This url domain[.]com/blog/category/subcategory/ i want to go here controllers/Blog.php->index() i want redirect this url domain.com/blog/index/category/subcategory/ to 404 I have this controller PHP Code: class Blog extends CI_Controller { I tryed this routes but don't work ( i can't appelate this domain[.]com/blog/ajax_method or other methods from controllers/Blog.php ) Method 1 $route['blog'] = 'blog/index'; $route['blog/.*'] = 'blog/index'; Method 2 $route['blog/(:any)/(:any)'] = 'blog/index/$1/$2'; ( with this method i can domain[.]com/blog/category/subcategory/ but i can't have this url domain[.]com/blog/category/subcategory/filter/brand_dell/color_red/ ) Method 3 PHP Code: $config['base_url'] = 'https://domain.com'; This method work but is no pro because this link domain.com/blog/category/subcategory => blog.php->index() and have this ['config'][uri][rsegments] = array('blog','index') this link domain.com/blog/ajax_method => blog.php->ajax_method() and have this ['config'][uri][rsegments] = array('blog','index') and here i need ['config'][uri][rsegments] = array('blog','ajax_method') i can change rsegments values in _remap but is no pro ![]() $route['blog'] = 'blog/index'; $route['blog/.*'] = 'blog/index'; PHP Code: function _remap() { |