How to redirect on WordPress 404 error

The default WordPress behavior for the 404 error (page not found) is to show 404 template that most of the time is a part of the active theme. With AAM 4.4 or higher you can redefine this behavior and redirect user to specific page, URL or trigger a custom PHP callback function.

WordPress 404 redirect

There are few reasons why would you want to define 404 redirect. Primarily, you want to provide better user experience and URL, that no longer available on your website, may be redirected to page that contain more useful information than just big 404 error message.

Note! If you are getting 404 errors on all your pages, then it is most likely you have some issues with your permalink. You may try to regenerate it by going to Settings->Permalink page.

These are couple very simple steps that will allow you to redefine 404 error handling.

Step 1. Switch to Default Access Settings. AAM allows you to manage access settings for any role, user or visitor separately. It is less likely that you would want to define separate 404 redirects based on who is browsing your website. That is why I’ve made the decision to enable this feature only for the Default access level that is inherited by all users, roles and visitors on your website.

Learn more » How to define “Default” WordPress access settings

Step 2. Define 404 redirect rule. From here you can define your custom redirect rule and permanently redirect users to any existing page, URL or trigger custom PHP callback function.

Conclusion

404 redirect is very important part of the user experience (UX) and should be always handled properly. Otherwise it most definitely negatively impact your website and business.

Get notified about important updates and new features (no more than one email per month).