Redirect 404 Page Not Found To Any URL

redirect 404 page

If fixing broken links is something you tend to avoid, here’s a simple solution which you might like as a quick fix until you can fix your broken links properly.

Please copy ALL the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++

This code will redirect ALL 404 page errors to the example.com url which you can change to anything you like.

More 404 Page Solutions


Comments

8 responses to “Redirect 404 Page Not Found To Any URL”

  1. Hello Brad Dalton, Thanks i its nice thing and helpful for SEO .
    But can i use it for phpmelody Video script page which is built by phpsmaarty template?

    1. Brad Dalton Avatar
      Brad Dalton

      It redirects any URL which returns 404 so i don’t think it matters where the template comes from.

      1. i tried it in the PhpMelody function.php file but It did not work for me. Just to let you know!

        1. Brad Dalton Avatar
          Brad Dalton

          It works perfectly in any theme.

          I know this because i tested it.

          The code goes in your child themes functions file and will not work in other files.

          Whats PhpMelody?

  2. But it affects SEO? or confuse our visitor. Better (for me) is redirect to a page for error 404 with a search box and related articles.
    (sorry for my bad english)

    1. Brad Dalton Avatar
      Brad Dalton

      I think its better to not have 404 errors and maybe direct to a page with a list of posts, categories and search box that works.

  3. Dave Fogel Avatar
    Dave Fogel

    Wow, that is pretty slick. I think I will use that.

    1. Brad Dalton Avatar
      Brad Dalton

      Easier than using your .htaccess file i think Dave.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.