digitalbricks Posted August 31, 2021 Share 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? Link to comment Share on other sites More sharing options...
elabx Posted April 1, 2022 Share 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. Link to comment Share on other sites More sharing options...
digitalbricks Posted June 3, 2022 Author Share 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. Link to comment Share on other sites More sharing options...
elabx Posted June 3, 2022 Share 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? Link to comment Share on other sites More sharing options...
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