How To Redirect 404 Not Found Page In Wordpress?



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".













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














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








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.

No comments:

Powered by Blogger.