How to solve the problem of WordPress migration server displaying 404 error page

Method 1: Log in to the background, refresh the “permanent connection” in the “Settings” once. For example, modify the connection setting method once, then save it, and then reset the setting you want to save. Many people can solve the 404 error through this method.

Method 2: Check whether the .htaccess file is correctly set in the main directory of WordPress.
The default settings are as follows (note possible directory changes after migration).
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Method 3. If the web server is not Apache but Nginx, then check the Nginx settings. The following code needs to be added to the website settings:
location / {
try_files $uri $uri/ /index.php?$args;

Method 4: Check whether Allowoverride of the corresponding directory of the web server Apache is set to All. This migration of the website to the new server is because the subdirectory overwrites the main directory settings, resulting in a 404 error page.
<Directory “/var/www/html/test”>
AllowOverride All