Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Use Uri::segment() in 404 ?
  • Hello !
    I would use Uri::segment() in my 404 page but the function returns me the name of my class.
    Is there a solution ? Or in the router, how to redirect all links to an once class except the routes already declared ? (Priority) Sorry for my english... Thanks a lot !
  • 404 processing in FuelPHP is done by a new Request as result of the not found exception. So you don't have access to the original request anymore. If you want to have all sorts of logic in your 404 controller it's better to use a 'last-resort' route:
    '.*' => 'controller/method404',
    
    as your last route, so it will catch everything that doesn't have a route. Note that this will disable automatic routing! Alternatively, create a new Uri class instance. See if "$uri = new Uri()" will pickup the requested URI, and if not, fetch it from Input::server() and pass it to the Uri constructor.
  • Thanks ! Its work.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion