• 25,450
  • +1,014
  • 2,796
How to Redirect 404 Not Found Page in WordPress?

How to Redirect 404 Not Found Page in WordPress?

Bookmark

The following How to Redirect 404 Not Found Page in WordPress is a simple tips and trick for your wordpress page redirection.

Usually when someone is playing too much with their blog and modified the permalink this could be happen you will lost a few of your page. 404 page also can be happen when you're accidentally delete your posts but you already broadcast the link everywhere. Below is step by step how to redirect your 404 not found page to your main blog address.

1. Open your themes editor(you can edit this option web based) then click "Editor".

How to Redirect 404 Not Found Page in WordPress?

2. Find the 404.php page in your themes, then click it.

How to Redirect 404 Not Found Page in WordPress?

3. Copy the code below and then paste it to 404.php file at the first line of code.

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>

4. Click "Update File" to finish the process

How to Redirect 404 Not Found Page in WordPress?

5. To check your code working or not, just type in your web address with unknown folder after slash.

Example : http://www.your_wordpress.com/asdfghjk

If the code above redirect to your main homepage, congrats…it's mean that your code already worked. 🙂

 

Share this article if you found this post was useful:

Blogger at hacking-tutorial.com. Love PHP, offensive security and web. Contact him at me[-at-]vishnuvalentino.com

See all posts by || Visit Website : http://www.vishnuvalentino.com

  • Thanks for brilliant post Vishnu…
    it’s working 100% for me