users who build websites using WordPressAfter setting the pseudo-static rules, except for the homepage being accessible, all other pages are
404 error, which is caused by not configuring the server's pseudo-static rules properly. This article explains
Solution for WordPress 404 Error on Baidu Cloud Virtual Hosting. If you are using a VPS and have installed the
Baota Panelor
LNMPone-click package, you can easily set up rewrite rules when adding a website. However, if you are using Baidu Cloud Virtual Hosting (BCH), the method for setting up rewrite rules is slightly more complicated. Below is the method for configuring WordPress rewrite rules on Baidu Cloud Virtual Hosting BCH; the process is similar for other applications.
Preliminary Preparation
Baidu Cloud Virtual Hosting BCHThere are two methods to set up rewrite rules: one is through the app.conf file, and the other is through the bcloud_nginx_gen.conf file. Naibabiji 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 yearsNote that the rule above customizes the 404 page to /error/404.html. If you want to use WordPress's default 404 page, delete this line. The file expiration time below is set to 10 years by default and can be changed to 30 days. Reference:
Baidu Cloud Help Documentationbcloud_nginx_user.conf
Please copy the code below 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 rewrite 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, not both). 2. In the Baidu Cloud Virtual Hosting BCH control panel, find the site start/stop section, then click the button next to reload site services.

3. Go to the WordPress site settings to set up rewrite rules and check the effect on the frontend. At this point,
rewrite rules for Baidu Cloud Virtual Hosting BCHare configured. Video reference:
BCH Rewrite Rules Configuration
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.