Script for 404 errors in wordpress

jiya raichand

Junior Member
Joined
Jan 3, 2018
Messages
150
Reaction score
20
Hi there,

I have a client who sells products, and they often delete product pages when the items are no longer available. This results in numerous 404 URLs on the WordPress website. When they have a similar product, they create a new page, but I have to manually redirect the old URLs to the new ones, which is time-consuming.

Is there a script or automated solution that can handle these redirects more efficiently? If anyone has done this before, I would appreciate your advice.

Thank you!
 
Last time I looked at AIOSEO it had a pretty neat redirects section that included a 404 tracker, allowing you to see where the dead pages are and add a redirect with a click, but it wasn't 100% automated.
 
Hi there,

I have a client who sells products, and they often delete product pages when the items are no longer available. This results in numerous 404 URLs on the WordPress website. When they have a similar product, they create a new page, but I have to manually redirect the old URLs to the new ones, which is time-consuming.

Is there a script or automated solution that can handle these redirects more efficiently? If anyone has done this before, I would appreciate your advice.

Thank you!
There are two ways you can achieve this:

1. Using free WordPress plugins like "Redirect 404 to Homepage" or "All 404 to Homepage" that can automatically redirect all 404 errors to the home page or specific page of your choice. It's easy to use. Make sure to 301 redirects for permanent page removals as it help search engines understand the new location.

2. Using code snippets, which offer more flexibility in handling the redirects. There several code snippets available on the internet. But it requires more technical knowledge.
 
Wait.. Why don't the shop just prevent an item from being sold if it's out of stock? It makes no sense to delete the pages.
If users get to a page with an out of stock product, offer them alternatives. This is money on the floor.
 
Use Wordpress plugins like "Redirection" or "Yoast SEO Premium," to save time by automatically managing the redirects for deleted product pages.
 
The Redirection plugin is one of the most popular plugins for managing redirects and monitoring 404 errors in WordPress
 
Using free WordPress plugins like "Redirect 404 to Homepage" or "All 404 to Homepage" that can automatically redirect all 404 errors to the home page or specific page of your choice. It's easy to use. Make sure to 301 redirects for permanent page removals as it help search engines understand the new location.
Redirecting all 404s to home is a really awful idea.
 
There are two ways you can achieve this:

1. Using free WordPress plugins like "Redirect 404 to Homepage" or "All 404 to Homepage" that can automatically redirect all 404 errors to the home page or specific page of your choice. It's easy to use. Make sure to 301 redirects for permanent page removals as it help search engines understand the new location.

2. Using code snippets, which offer more flexibility in handling the redirects. There several code snippets available on the internet. But it requires more technical knowledge.
No, I dont want to redirect all 404 to hone page. I want them to redirect to their designated page or most relevant page.
 
Use Wordpress plugins like "Redirection" or "Yoast SEO Premium," to save time by automatically managing the redirects for deleted product pages.
Screenshot 2024-06-25 at 11.02.50 AM.png

I have already installed the plugins, but it seems they are not redirecting the pages automatically.
 
Wait.. Why don't the shop just prevent an item from being sold if it's out of stock? It makes no sense to delete the pages.
If users get to a page with an out of stock product, offer them alternatives. This is money on the floor.
Actually, there is one tool they are using, and all the issues arise because of that tool. It is used to manage product lists, and someone updated it, which seems to have changed the URL structure. Now, I am doing manual redirects, but there are too many pages, making manual redirects impossible.
 
Check out the Redirection plugin. You can use it to set up patterns and conditions for automatic redirects.
 
plugin: WP 404 Auto Redirect to Similar Post ???
to home? 404.php of the theme

Code:
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>
 
I have a client who sells products, and they often delete product pages when the items are no longer available. This results in numerous 404 URLs on the WordPress website. When they have a similar product, they create a new page, but I have to manually redirect the old URLs to the new ones, which is time-consuming.

Is there a script or automated solution that can handle these redirects more efficiently? If anyone has done this before, I would appreciate your advice.
Hello,
For managing redirects more efficiently on your WordPress website, consider using the Redirection plugin. It automatically handles 404 errors and allows you to set up redirects easily. Additionally, Yoast SEO Premium includes a redirect manager that can simplify this process.
If you're comfortable with coding, you can implement server-level redirects using .htaccess for Apache or Nginx configuration. Regular expressions can also help automate pattern-based redirects.
For a custom solution, a developer can create a PHP script to automatically redirect deleted product pages to similar ones.
These methods should help save time and improve the efficiency of handling redirects.
Thank you!
 
Back
Top