axllent / silverstripe-intelligent-404
Add additional smart redirection functionality to the existing 404 ErrorPage
Installs: 5 383
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 3
Forks: 3
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- silverstripe/framework: ^4.0
This package is auto-updated.
Last update: 2024-10-27 22:51:51 UTC
README
An extension to add additional functionality to the existing 404 ErrorPage. If a 404 page is called, it tries to guess the intended page by matching up the last segment of the url to all SiteTree pages. It also uses soundex to match similar sounding pages to find other alternatives.
Other DataObjects (eg: products) can be added too provided they contain a Link()
function
How it works
If a 404 error is detected (note: does not work in dev
mode by default):
- It will search SiteTree for all matching URLSegments, as well as any that sound the same (using PHP's soundex()).
- If 1 exact match is found, a 301 redirect is sent.
- Else if no exact match is found, and 1 similar page is found, a 301 redirect is sent to the similar page.
- Else if more than 1 exact or similar page is found, a regular 404 page is shown and the list of possible options is shown (ie: "Were you looking for one of the following pages?") directly beneath it.
- Else a regular 404 page is shown.
Requirements
- SilverStripe 4
For SilverStripe 3, please refer to the SilverStripe3 branch.
Installation
composer require axllent/silverstripe-intelligent-404
Usage
Please see Configuration.md for configuration options and documentation.