Directory / plugin
4zero4
v1.2 · by Fabio Moro
Turn "page not found" (404) errors into a helpful search instead of a dead end.
About this plugin
4zero4 makes your 404 pages useful. When a visitor reaches a URL that no longer
exists, the plugin builds a search query from the requested address and redirects
the visitor to your site’s search results, so they land on relevant content
instead of an empty error page.
For example, a request for /my-old-product-name/ that no longer resolves is
turned into a search for “my old product name”.
Key points:
- Zero configuration. Activate it and it works.
- Temporary redirect (302). The original URL may become valid again, so the
redirect is never cached as permanently moved. - Front-end only. It never interferes with the admin area, feeds or the REST
API, and only acts on normal GET page views. - No external services. The plugin does not send any data anywhere and does
not use tracking or analytics.
Developer hooks
The behaviour can be customised with filters:
p4zero4_search_terms— change (or clear, to skip) the terms extracted from the URL.p4zero4_redirect_url— change (or clear, to cancel) the destination URL.p4zero4_redirect_status— change the HTTP status code (default302).