[wordpress插件] Custom Error Pages自定义错误页面

wordpress 插件 文章 2020-04-08 01:01 792 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

WordPress offers inbuilt support for custom 404 pages on all themes.

WordPress对所有主题的自定义404页面提供内置支持。

But what about custom pages for other common errors like 401 and 403?

但是,针对其他常见错误(例如401和403)的自定义页面呢?

You end up seeing a bland error page of the Web Server.

您最终看到Web服务器的乏味错误页面。

With this plugin you can easily create custom 401 and 403 error pages with any theme without writing a single line of code!!!

使用此插件,您可以轻松创建具有任何主题的自定义401和403错误页面,而无需编写任何代码!

And the best part is that you set it and forget it.

最好的部分是您设置它并忘记它。

Yes, you don’t have to do any changes even if you change themes.

是的,即使您更改主题也无需做任何更改。

The heading and text you want on 401 and 403 error pages are displayed on the currently active theme.

您要在401和403错误页面上显示的标题和文本会显示在当前活动的主题上。

Further Reading

进一步阅读

安装步骤

    1. Install and activate the custom error pages plugin.
    2. 安装并激活自定义错误页面插件。

    3. From the wp-admin go to Settings > Custom Error Pages, fill in the heading and content boxes, save the changes and preview it.
    4. wp-admin 转到“设置”>“自定义错误页面” ,填写标题和内容框,保存更改并预览。

    5. Configure your web server to use a custom error page.
    6. 配置您的Web服务器以使用自定义错误页面。

    Apache users edit your .htaccess file and add the following lines.

    Apache用户编辑您的 .htaccess 文件并添加以下行。

    ErrorDocument 403 /index.php?status=403

      ErrorDocument 403 /index.php?status=403

    ErrorDocument 401 /index.php?status=401

    ErrorDocument 401 /index.php?status=401

    Nginx users edit your nginx.conf file and add the following lines.

    Nginx用户编辑您的 nginx.conf 文件并添加以下行。

    error_page  403 = /index.php?status=403

      error_page 403 = /index.php?status=403

    error_page 401 = /index.php?status=401

    error_page 401 = /index.php?status=401

    Try accessing a file or directory which is forbidden like

    尝试访问禁止的文件或目录,例如

    http://www.example.com/.htaccess

    http://www.example.com/.htaccess

    http://www.example.com/wp-includes/

    http://www.example.com/wp-includes/

    Did you see a custom 403 page in all the glory of your theme?

    您是否在主题的所有荣耀中都看到了自定义的403页面?

下载地址
https://downloads.wordpress.org/plugin/custom-error-pages.1.1.zip
-EOF-

AI助手支持GPT4.0