Hi,
I’ve made changes to my membership site: When a user signs up and logs in, certain public pages will be hidden from them, as they are suppose to navigate forward and view the member pages. This works smoothly most of the time, except if a user hits the back button (or manually enters a URL) and tries to access the pages they already visited before logging in or signing up. They would then see a 404 page if viewing a public page (now hidden from them).
I’d like to create a custom 404 page with some useful links and a message letting them know where to go.
I have a child theme and can add 404.php to it for editing. But, I was curious if you guys have a template with all of the page items removed (search bar, categories, tags, etc)? This would be easier for me to use to edit.
My 404 page would simply need to contain a few sentences and links.
I have redirection plugin installed. If it is easier to use that to redirect to a page I create, I am open to that as well.
Hi hardel
Using redirection would indeed be easier than editing the 404 template in your child theme. When adding a new redirect under action you can choose 404. Let me know how that goes.
Hey Andrew,
How do I set up the 404 redirect? I tried to, and it did not work.
I’d like to redirect to this page for all 404 errors: https://rockclass101.com/404-error-page-not-found/
The options in redirection are:
Source URL: (blank)
Match:
1) URL Only
2) URL and referrer
3) URL and user agent
4) URL and login status
Action: Error (404) – as you stated to use
Regular expression: (check or leave unchecked?)
Group:
1) Redirections
2) Modified Posts
Sorry, taking a harder look now I’m not sure Redirection can make this change for us.
Perhaps this plugin will help?
https://wordpress.org/plugins/custom-404-pro/
Andrew,
Can you help me with a manual edit or redirect? Is it possible to place a code in the child theme 404.php to redirect to a custom page I made? Or can we add a code line to my htaccess file to do this?
I realize I can edit the child 404.php file, but I would prefer to use the page builder layout for a nicer 404 page appearance.
You can edit your htaccess file and set it that way for sure:
http://www.thesitewizard.com/archive/custom404.shtml
Htaccess will not work b/c of WP overwrite rules.
So the solution was to create a child theme 404.php and input the following code. Hope this helps someone, as it is extremely useful since my site is a business, I need a custom error page to help redirect logged in/out members.
Here is the link for the code: http://webmaster.iu.edu/tools-and-guides/maintenance/php-redirect.phtml
Thanks for sharing your process here. Glad to hear you were able to resolve in the end.
All the best.