Home Experience & Tips Sharing Standard Post

Standard Post

Baidu Cloud Virtual Host BCH Pseudo-Static Rules_Solving WordPress 404 Error

After building a website with WordPress and configuring the pseudo-static rules, if only the homepage is accessible and all other pages return a 404 error, it is because the server's pseudo-static rules are not properly configured. This article introduces the solution to the WordPress 404 error on Baidu Cloud virtual hosts. If you are using a VPS and have installed it on Baota Panel or LNMP one-click...

Updated on November 15, 2019 About 3 minutes reading
百度云虚拟主机BCH伪静态规则_解决WordPress404错误

users who build websites with WordPressAfter setting pseudo-static rules, only the homepage is accessible, while all other pages are404 errorThis is caused by improperly configured server pseudo-static rules. This article introducesSolution for WordPress 404 errors on Baidu Cloud Virtual Host

If you are using a VPS and have installed it onBaota PanelorLNMPone-click package, you can easily set pseudo-static rules when adding a website. However, if you are using Baidu Cloud Virtual Host BCH, the method to set pseudo-static is slightly more troublesome. Below is the method to configure WordPress pseudo-static for Baidu Cloud Virtual Host BCH; methods for other programs are similar.

Preparations

Baidu Cloud Virtual Host BCHThere are two methods to configure pseudo-static rules: one is through the app.conf file, and the other is through the bcloud_nginx_gen.conf file.

Naiba recommends using the second method, but both methods are introduced here.

app.conf

Please copy the code below and save it as an app.conf file

handlers:
    - url : /
    script : /index.php
    script : /index.html

    - rewrite_not_exist: (.*)
    script: /index.php/$1

    - errordoc : 404 /error/404.html

    - expire : .jpg modify 10 years
    - expire : .swf modify 10 years
    - expire : .png modify 10 years
    - expire : .gif modify 10 years
    - expire : .JPG modify 10 years
    - expire : .ico modify 10 years

Note that the above rule customizes the 404 page as /error/404.html. If you want to use WordPress's default 404 page, delete this line.

The following file expire is the file expiration time, set to 10 years by default, which can be changed to 30 days.

References:Baidu Cloud Help Documentation

bcloud_nginx_user.conf

Please copy the following code and save it as bcloud_nginx_user.conf

location / {

        try_files $uri $uri/ /index.php?$args;

}

# Add trailing slash to */wp-admin requests.

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

Specific method

After preparing the app.conf or bcloud_nginx_user.conf file, you can start configuring the pseudo-static rules. The method is as follows:

1. Use FTP software to upload the app.conf or bcloud_nginx_user.conf file to the website root directory (upload only one of them, not both).

2. In the Baidu Cloud Virtual Host BCH control panel, find the site start/stop and click the button after Reload Site Service.

百度云虚拟主机BCH3. Go to the WordPress site settings to configure pseudo-static rules, and check the frontend effect.

At this point, thethe pseudo-static configuration for Baidu Cloud Virtual Host BCHThe configuration is complete.

Video reference:BCH Pseudo-Static Rule Configuration

5/5 - (2 votes)
Previous Search Limiter & Blocker: A Plugin to Limit Search Frequency and Rate for WordPress Site Users Continue reading content around the same timeline. Next Simple Windows Network Speed and Temperature Monitor Tool: Wise System Monitor View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: