Welcome Guest, Not a member yet? Register   Sign In
Undefined function and page not found
#1

[eluser]Lima[/eluser]
Hi there, I need your help.

By default CI will show '404 Page Not Found' if there is no controller or undefined function in controller.

For example, I have controller 'foo' and the functions 'index', 'bar', 'test' in 'foo' controller.

Url 'http://www.mydomain.com/foo' or 'http://www.mydomain.com/foo/index' will call 'index' function in 'foo' controller.
Url 'http://www.mydomain.com/foo/bar' will call 'bar' function in 'foo' controller.
etc...

BUT, url 'http://www.mydomain.com/foo/home' will show '404 Page Not Found'.

**My First Question**
How to make url 'http://www.mydomain.com/foo/home' will not show '404 Page Not Found', because 'home' function is undefined, but it will call 'index' function in 'foo' controller as default.
OR if there is no index function it will be redirected to default route in config/route.php



Url 'http://www.mydomain.com/wallet' will show '404 Page Not Found', because 'wallet' controller does not exist.

**My Second Question**
How to redirect all url that does not have controller to default route in config/route.php


Thanks

Lima

Indonesia
#2

[eluser]gtech[/eluser]
I think httpd.conf in your webserver should allow you to change the default 404 page. I know this is the case for apache anyway.
#3

[eluser]Thorpe Obazee[/eluser]
You can use htaccess but it's not quite the best solution. You'd be getting 'duplicate contents' penalties from Google.




Theme © iAndrew 2016 - Forum software by © MyBB