Better 404 Handling

Describe the problem you would like to solve
I would like a way for plugins/themes to be able to provide a better 404 experience

Describe the solution you’d like
Hooks for plugins/themes to be able to change the 404 experience. Potentially to display a different error message and/or redirect to a new URL

Who is asking for this feature?
Administrator from an SEO prespective/User Experience

Additional information
I did try adding Hook::call('Dispatcher:404'); to the Dispatcher class in PKP lib which works mostly, except the case where there’s no context set yet and this gets a bit too deep for me to quite know a possible resolution to this.

There is a third-party plugin for this:

We have it in action, there are versions for both OJS 3.3 and OJS 3.4 . Works fine.

Here you see an example of a custom 404 not found page:
https://www.swissdentaljournal.org/gugus

3 Likes

Ah fantastic! I might look at expanding this with redirects for taking over a non-OJS site

Ah, while using this got me most of the way there - I did still need to do a small change to PKP lib in order to get it to allow any context to start and then it allowed for the 404 handling style as described in the plugin above. I think mostly as the swiss dental journal is a singular journal whereas I’m working with a publisher on multiple journals within the same site, with a global homepage.

I’ve submitted a pull request for PKP lib to allow this Allow global context to be assumed instead of 404ing by kennydude · Pull Request #10326 · pkp/pkp-lib · GitHub