digitalbricks Posted August 31, 2021 Posted August 31, 2021 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?
elabx Posted April 1, 2022 Posted April 1, 2022 Hi @digitalbricks! Did you ever figure out what was going on? I am having a similar situation while loading two pw instances.
digitalbricks Posted June 3, 2022 Author Posted June 3, 2022 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.
elabx Posted June 3, 2022 Posted June 3, 2022 No worries mate! I precisely saw this issue commented here: https://github.com/processwire/processwire-issues/issues/1569 Did you see that or arrived to the solution by chance?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now