Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing Controller name from URL in CodeIgniter

Currently in my CI project I have a single controller that handles all things account. Such-as register, login, activation, etc.

My routes work as such...

domain.com/account/login/ or domain.com/account/register/

How can I remove account from the route while also being about to remove the controller from other pages.

I basically want the controller to always be removed. One of my reasons for this is SEO, search engine rank the importunateness of a page based on how deep it is in a website.

The only way I have seem to achieve this is to do some thing like route['activate'] = 'account/activate'; for every single page, which would be a huge hassle.

like image 631
Paramount Avatar asked Jul 10 '26 17:07

Paramount


1 Answers

$route['^(?!other|controllers).*'] = “account/$0″;
like image 128
Vova Popov Avatar answered Jul 13 '26 13:07

Vova Popov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!