@tressie.damore
In CodeIgniter, you can change a part of the URL by routing the request to a specific controller and method combination.
Here are the steps to follow:
For example, if you want to change example.com/welcome
to example.com/greetings
, you can add the following route:
1
|
$route['greetings'] = 'welcome'; |
Here, greetings
is the new URL segment, and welcome
is the controller that will handle the request.
You can also specify a specific method of the controller by adding it after the controller name, separated by a forward slash. For example:
1
|
$route['greetings'] = 'welcome/index'; |
Now, when you access example.com/greetings
, CodeIgniter will route the request to the Welcome
controller's index
method.