Support » Plugin: Simple 301 Redirects » How do I redirect all non-existent URL's to the homepage?

  • Resolved yifa


    Hi there,

    I have an eCommerce website and I have hundreds of old product that are no longer existent, but I’m getting errors for them all (according to my SEO guy, and he advises that I need to redirect them).

    How can I redirect all non-existent URL’s to my homepage? Is there one easy step for this, or do I have to find out each and every URL?

    Thanks in advance,


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Scott Nelle


    I’m afraid my plugin isn’t set up to redirect all broken links to the home page, but here’s a method to do it:

    1. Edit (or create) 404.php in your theme.
    2. Replace everything in 404.php with the following:

    <php wp_redirect(site_url(), 301); exit(); ?>

    Do I have to replace site_url with my actual url? And will this help with SEO to get rid of these 301 errors?

    As you can tell, I’m not very knowledge on this stuff.




    You do not have to replace site_url with your actual URL. site_url() is a WordPress function that returns the actual URL of your site.

    A 301 is the code for a redirect and is not an error. I assume you meant ‘will getting rid of the 404s help with SEO’? There seems to be some debate on this topic but the short answer is yes …and no. Google will not penalize you for having 404 errors but you may want to 301 some of those 404s if they are getting a lot of links and traffic.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I redirect all non-existent URL's to the homepage?’ is closed to new replies.