Welcome Guest, Not a member yet? Register   Sign In
Remove controller and function both from URL.
#1

Hi,
I need to remove controller and function both from url.

Eg: http://localhost:8080/ci/site/pages/Home/

I need to remove site/pages from my url

So my desired url should be http://localhost:8080/ci/Home

Please let me know, what code should be applied to do the following.
Reply
#2

Add this to your config/routes.php file:
PHP Code:
$route['home'] = 'site/pages/Home'

Now, if a user has typed the url http://localhost/ci/home, the route will redirect the request to the method "pages" inside the controller "site". The section 'home' is recognized as parameter of the method.
Reply
#3

You can read the routing section doc for more details on this but @Wouter60 has given you a right hint.

Though, I have written a library to ease the process of maintaining routes in CI. Have a look, may be it could be helpful for you

https://github.com/aajiwani/LaravelRouti...odeIgniter
Reply




Theme © iAndrew 2016 - Forum software by © MyBB