404, 403, 500, 502 of WordPress installation and use and solutions

WordPress Technology Blog Wp application technology Site Templates FAQ

Common status prompt codes for incorrect website access: 404, 403, 500, 502

When we use WordPress to build websites, we will encounter some problems, which generally fall into two categories.

The first case is program error : Program errors generally display error or warning prompts on the top of the website or other parts of the website, such as error:..., Notice:...., warning:

These are the problems that occur in the running of the program. Generally, if the server does not mask the PHP error, these prompts will appear. Generally, for security reasons, the server or virtual host will mask the error, and then the screen will be blank, or the web page will not display fully (stop loading down where the error occurs). Such problems need to start with the program, such as plug-ins Whether the theme is damaged, whether it is compatible with the latest version, and so on. Such problems need to be solved by contacting the website software program provider.

This kind of problems will not be explained here.

The second case is that the server reports an error: The server reports an error with a special code to prompt. As our title says, we will analyze the general reasons and countermeasures for these prompts.

The meaning of the common error status code prompt and the general solutions will be analyzed in detail below.

 

Website access display status 404 (Not Found)

When 404 appears during website access, it is the status that the current URL cannot find relevant resources on the server, and the status that cannot be found appears. For WordPress, 404 appears in the following states.

1. The home page of the website can be opened, and all the internal pages are in 404 status

This state is because WordPress is a dynamic program by default. If the server does not do pseudo static but selects static links, such as article name links, digital links, etc., then the rewriting without pseudo static will display 404 state. Therefore, if this situation occurs, we can generally do pseudo static on the server, There are many ways to deal with pseudo static. Each Web engine (common: IIS/Apache/Nginx) handles it differently. You need to deal with it yourself or contact your server vendor to help you deal with it.

2. All websites including the homepage 404

If you visit the home page with 404, you need to check whether there are problems with your domain name resolution and host binding. If it is a virtual host, you need to check whether the host you resolve and bind is correct. In this case, it is usually resolved to another virtual host without data, and then 404 is displayed.

If you are using a server, you need to check whether the directory you bind is consistent with your WordPress website directory. If they are inconsistent and bound to the wrong directory, 404 will also occur.

3. The foreground of the website is normal, and 404 appears on some pages of the background

This usually happens on the IIS server. For example, click the article in the background of WordPress, or click the category directory and tag to display 404, while other content is normal.

This situation is generally caused by the incorrect pseudo static of IIS. You can try to restore web.config to the original version, that is, the version before the pseudo static, and then all the options are normal. This requires that your pseudo static file configuration is faulty and needs to be reconfigured to display correctly.

Website access status display 403 (Forbidden)

When a website accesses 403 status, it means that you do not have permission to access the resource. This situation is generally caused by two problems.

1. The site directory permission is set to unreadable

If the permissions set for the root directory of your website are unreadable and writeable, then the files in the entire directory have no permissions to access, which requires you to change the permissions of your server directory.

2. The website has no home page identification file (default home page)

Wordpress is a php program, so the default home page should be index.php. If you do not set the default home page file, the program cannot be anything else. Some servers will display 403, and some will display 404. This problem needs to check whether your default home page is set correctly.

Website access status display 502 (bad gateway)

Website 502 is generally caused by a process error when accessing WordPress. An error occurs when a process is running, which causes the process to stop working. Generally speaking, there are several situations:

1. Wordpress installation and installation completion background part page display 502

This problem is usually caused by the combination of CentOS 6. x system+PHP 5.2+the latest WordPress program. Generally speaking, we do not recommend running WordPress in versions below PHP 5.3. WordPress currently recommends using versions above 5.6, which is more stable.

The solution is also simple. Upgrade to php5.3 or above, or replace CentOS with another system.

2. The website is installed and running normally, but the status of 502 appears from time to time

If this is the case, the reason is relatively complex, generally due to the server environment is not well built. If this happens frequently, it is recommended that the whole station backup and rebuild the server environment to solve this problem.

 

Website access status display 500 (Internal Server Error)

The website 500 error shows an internal server error. There are many reasons for this error.

1. 500 caused by website program error

This situation is generally caused by other pages' normal access to a specific page or execution of a specific operation. Some servers do not display PHP warnings, errors and prompts directly, but display 500 errors directly. This will cause us some problems. However, if this happens as mentioned above, Then it is the error caused by program execution.

If you know something about php programs, you can first open the php error prompt, find display_errors in your php configuration file php. in, change off to on, and save to open. After opening, you can see which program has a problem,

If no problem is found, you can open the debug mode of wordpress, find the define ('WP_DEBUG ', false) in the configuration file wp-confing.php of wordpress, and modify it to define ('WP_DEBUG', true). Then you can open the debug mode, so that you can successfully find the program file and code that caused the error.

2. Due to the php version

If you are using a lower version of PHP, you may encounter a situation of 500. Before doing other operations, you can upgrade the PHP version to a higher version (above 5.6 is recommended), and then check the status,

Or the version of php you installed is too high, and the program is compatible, such as php7

In PHP 7, a large number of functions are abandoned and replaced with new functions. If your program is compatible with PHP 7, problems will also occur. In this way, you need to update the program to be compatible with PHP 7, or reduce the server's PHP version to 5.6.

3. Site directory permission

Incorrect website directory permissions can also cause 500 cases. The permissions of Windows system hosts, folders and files can all be 777; However, the permissions of the host, folder and file of the Linux system are set to 777. This is an error, and 500 errors will occur when accessing.

The correct file permissions for Linux hosts are: folder: 755; File: 644. But there are special cases. For example, the XML file of Baidu is usually set to 777, which does not affect the normal operation of the website.

You can also find problems from the website directory.

4.301 500 caused by steering

If you don't know much about the 301 steering, and you use a server instead of a virtual host (generally, the 301 of a virtual host has options that can be set without errors), you add incorrect code to the 301 steering file, and incorrect code is added to web.config,. htaccess and other files, which will also cause the 500 situation.

So when 500 appears, you can also check in this direction.

In a word, 500 errors can be caused in many ways, which requires patient inspection one by one.

Here are some http error prompts when accessing WordPress today. I hope they can help you!

 

 

Previous:

Next:

Article comments

Cancel Reply
    Expand more