Home » Php » php – CodeIgniter – Remove "Index" From URL

php – CodeIgniter – Remove "Index" From URL

Posted by: admin July 12, 2020 Leave a comment


NOTE: I’m not talking about removing index.php – I mean index – the method name.

My current URL looks like this:


This is what I want it to look like:


How would I go about doing this?

Thanks in advance!

How to&Answers:

You can set up the routes for this, in application/config/routes.php, add a new line:

$route['view-topic/(:any)'] = 'view-topic/index/$1';

This will route your URL http://url.com/view-topic/anythinggoeshere will mask the view-topic/index/anythinggoeshere controller.

More information on routing: