durai durai - 1 month ago 12
PHP Question

How to remove controller name in URL of codeigniter and need to add menu and submenu as URL name

I need to remove controller name from URL of code igniter
For ex

Www.example.com/controllername/functionname
www.example.com/welcome/about us
Www.example.com/welcome/our services


I need URL as

Www.example.com/functionname
www.example.com/about us
Www.example.com/our services


Then also i need to have sub menu for our services that URL shoild look like

Www.example.com/welcome/our services/service1
Www.example.com/welcome/our services/service2


How to achieve this routing in code igniter

KFE KFE
Answer

if you ONLY want to remove 'welcome' from the URL,

you could do:

$route['(:any)'] = "welcome/$1"