Jump to content

Recommended Posts

Posted

Hello community,

in order to prevent the output of a paginated page – when there are no items for the given page number – i always used a 404 exception based on Ryans recommendation. Such as

if($input->pageNum>1 AND !count($stores)){
    throw new Wire404Exception();
}

That worked well in the past.
But in a current project throw new Wire404Exception() and also wire404() are both causing an infinite redirect loop.

Having a look in the network inspector, i saw that there are ping-ponged redirects from e.g. from /page2 to /page2/ to /page2 to /page2/ and so on. Essentially rediects between the page WITH and WITHOUT a trailing slash. Fiddling around i found that this is caused by the trainling slash setting of the page template: This infinite redirect only happens if a trailing slash on the page number url segment is enforced – if the setting is "doesn't matter" than the 404 works as expected again.

I really like to enforce the trailing slash but this seems to break the 404 exception handling.
Did I oversee something?

  • 7 months later...
  • 2 months later...
Posted

Sorry @elabx, i've overseen your message until now.
But no, I didn't figure out what's causing this issue. For my case, disabling the enforcement of the trailing slash solved the problem – but i am still not very happy with that workaround.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...