Welcome Guest, Not a member yet? Register   Sign In
Redirect when no parameter passed
#9

(05-11-2020, 10:52 PM)jreklund Wrote: What setAutoRoute(true) does are that it's turning the first segment of the url into a Controller name. In this case it's looking for an controller named "Deleteportfolio", and trying to access it with the method index() as you didn't specify a second segment (the method name).

What you need to do are to create a second route:
PHP Code:
$routes->get('deleteportfolio''Homepage::index'); 

Or point it into deleteportfolio, if you want it to redirect.
PHP Code:
$routes->get('deleteportfolio''AdminHome::deleteportfolio'); 

Or redirect inside the router, now you don't need the is_null($id) check.
PHP Code:
$routes->addRedirect('deleteportfolio''/'); 

This are something you need to be doing to all urls you are remapping from the normal example.com/controllername/method/id

What an easy thing... Thank you so much
Reply


Messages In This Thread
Redirect when no parameter passed - by bomi - 05-10-2020, 11:37 PM
RE: Redirect when no parameter passed - by bomi - 05-11-2020, 12:54 PM
RE: Redirect when no parameter passed - by bomi - 05-11-2020, 01:13 PM
RE: Redirect when no parameter passed - by bomi - 05-11-2020, 01:35 PM
RE: Redirect when no parameter passed - by bomi - 05-12-2020, 11:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB