Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
_404_ overwrite the Uri::segment ?
  • Request URL:
    localhost/testing234

    Expect Result:
    testing234

    Received Uri:
    front/checkUser

    Route:
    "_404_" => "front/checkUser"

    why?
  • Yes.

    404 is generated by the router when it detects it has nowhere to route, and it will do that by throwing an HttpNotFoundException.

    If you don't have any code in place to capture that exception, it will bubble up to your index.php, where it is caught, and a new request is constructed for the defined 404 route. Uri functions work in the context of a request.

    You can access the main requests URI using

    \Request::main()->uri->get_segments();

Howdy, Stranger!

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

In this Discussion