Menu Close

Redirect a WordPress 404 Page to Home (Simple)

WordPress Admin (youraddress / wp-admin) page 'Theme Design' → 'Theme Editor' → If you access '404.php' among 'Theme Files' on the right side, there will be a lot of things written. Replace it with code.


header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));

If you can't set it on the theme page, you can change it through an FTP service like Filezilla. (The 'customify' reference path for the 'AWS' service is '/opt/bitnami/apps/wordpress/htdocs/wp-content/themes/customify/404.php')

Various details can be added and the description can be long, but the practical use of the useful tip is the simplest method, and '' actually uses this method.

If you access all the 404 error pages, the code will take you to the homepage of the site. After you apply it, you can see that you go directly to the main screen when you enter anywhere on your site. (ex '' → '')

The advantage of this setting is that the first time a user is redirected to the main page when they access a deleted or faulty page, the user experience is better than just an error page if the main screen is properly decorated. Can be provided. (A side effect of this is that if the main screen is not properly set up, it may be an error page and may be forcibly kidnapped.)

In addition, if the main screen is set up well to prevent user churn, it may be advantageous for SEO.

As a result, it's not always an advantage, but it's a great feature if you use it clearly.

Leave a Reply

Your email address will not be published.

Posted in All, Wordpress

이메일 구독 - Email Subs

최선을 다해 직접 만든 콘텐츠만 공유합니다.
We share the best content we have created.