How to use htaccess to customize WordPress 404 pages

Source: Internet
Author: User
Keywords WordPress

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

When you see this title, you may have two questions: 1, why do you want to define a 404 page, wordpress template is not a 404.php to deal with the page does not exist? What I want to say is that this 404 page is really convenient, but when your site is done for a long time, It is likely to appear a large number of 404 pages, such as the former is to do a Web site for information, when the revision of WordPress blog, there will be a large number of 404 pages, and search engines will continue to visit these non-existent pages, which increased the burden on the server, Using htaccess to customize a static 404 page can solve this problem. 2, the use of htaccess custom WordPress 404 page that is not easy, directly in the htaccess file add code errordocument 404/404.html, and then a new 404.html file uploaded to the root directory OK. But this method is not feasible, because the default rewrite rule is to point all the requests to the index.php script, including, of course, nonexistent pages, if you add the normal 404 Page setup code, will not have any effect. Say so much, I believe you already understand why to customize a 404 page for WordPress. Here's how to customize 404 pages.

1, the first step of course is to create a 404.html file, and upload to the site root directory

2, delete the original rewrite rule file htaccess, add the following rules below.

# BEGIN WordPress errordocument 404/404.html rewriteengine on Rewritebase/rewriterule ^archives/.*$/index.php [L] Rewriterule ^feed.*$/index.php [l] rewriterule ^page/.*$/index.php [l] rewritecond%{request_filename}!-f RewriteCond% {request_filename}!-d # End WordPress

Archives is the URL format of the article, such as/ARCHIVES/88, can be modified according to their actual article URL. If your blog is installed in the WordPress directory, you must add Rewriterule ^wordpress/.*$/index.php [L] in the back.

Article Original start: http://www.leicheng.net/use-htaccess-customize-wordpress-404/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.