Most Internet users are familiar with the mistakes that sometimes arise when working with a site or searching for information in search engines. If you are the owner of a site that has suddenly started to issue such errors, it is important for you to understand what they mean, the reason for their occurrence and how to eliminate them.
Often in various forums on the Internet you can see discussions on the topic of eliminating errors on the site. Sometimes the problems that have arisen are insignificant and can be solved by the user independently, without resorting to specialists.
In order to know what to do in an unforeseen situation, it is worth getting acquainted with a description of the most common mistakes, as well as reading a guide to fix them.
HTTP Error Fix – Types of errors
HTTP protocol errors occur if the web server for some reason can not successfully send the requested document to the user. In this case, the server will report the error code to the user in the HTTP header.
Error codes are positive and negative or successful and not successful.
There are 4 types of codes in total (xx is a combination of any digits):
- 2xx – the request was successful
- 3xx – request successfully redirected – also positive code.
- 4xx – error – the document was not sent to the user, because a critical error occurred. The code class 4xx is intended to indicate errors on the part of the client.
- 5xx – server error – a critical error on the server. 5xx codes are allocated for cases of unsuccessful operation through the fault of the server.
The most interesting for the site owner are codes that indicate errors from the client or server. The causes and methods for eliminating these errors are presented below.
HTTP Error Fix | Error 400 – “Bad Request”
When navigating to the site, the browser can issue a “400 Bad Request”. This means that the server detected a syntax error in the request that the user entered. However, such a mistake can appear not only when you enter the site address, but also, for example, when you enter the control panel of your site. There can be several reasons for the occurrence:
- Browser blocking by antivirus
- Blocking the Windows Firewall with a browser
- A large number of cookies and data in the cache
- Interruptions in the Internet
In order to determine which of the listed options applies to your situation, you need to check and validate each of them until the problem is completely eliminated. Let’s start with the first possible reason.
- Study the settings of your antivirus in the section called “Rules for Applications” or similar.
- Check if your browser is listed and what is the level of trust in it
- Increase the level of trust in your browser if it is low
- Save the new settings and try again to enter the control panel
If the error persists, go to the next reason.
Windows Firewall Lock
- Try to disable the firewall for a while: Start Menu – Control Panel – System and Security – Windows Firewall – Enable or Disable
- clear cache and cookies
- refresh pages with an error
- If the issue is resolved, add the following programs to the firewall to complete it: Start – Control Panel – System and Security – Firewall – Allow the program to run through the firewall.
- Delete cookies and clear cache: press Shift + Ctrl + Delete while the browser is open.
- Delete unnecessary files
- Check your browser
Interruptions in the Internet
- Contact your ISP and find out if they have any work
- Clarify how long the work will take
HTTP Error Fix | Error 403 – Access Denied
Error 403 means that the server can not execute the request because of the denial of access to the requested files or pages. This error can occur for a number of reasons. Consider the most common:
- The index file index.html is not loaded into the public_html directory of your site or is incorrect. To resolve this error, create a file named index.html or rename an existing file. Possible options for the file name: index.html, index.htm, or index.php.
- For the directory in which the requested file is located, such rights are set that the Apache web server could not read the file on the server disk. To resolve this error, try changing the permissions in the section that manages the rights.
- The site files are uploaded to the wrong directory. To fix this error, check if the site files are located in the site / public_html directory, where site is the name of your site.
Error 404 – File not found
Error 404 means that the server can not find data on the user’s request.
The causes of this error:
- Incorrect URL entered in the address field of the browser. To resolve this error, make sure that the link is correct.
- The file requested by the URL is not present on the server. To resolve this error, you need to check if the requested file exists in the public_html directory of your site.
Error 500 – Internal server error
Error 500 means that there is an internal error on the server. This problem can occur for two reasons:
- Unable to start the script. Most likely, there are incorrect access rights to folders and files. If PHP files of scripts placed on your hosting have access rights of 777, execution of these scripts can be blocked by the server. This is due to the fact that permissions 777 allow everyone to make any changes to this file, which significantly affects the security and integrity of your site. To resolve this error, you should check the permissions on the folders and files on the site. For folders it is recommended to set the access rights to 755, for executable scripts 600, and for all other files 644.
- Incorrect instruction in the .htaccess file or the presence of unsupported directives in it. Perhaps you made a mistake in writing the name of the desired directive or parameters to it. You can correct this error by including the error log error.log. The web server will tell you which directive it deemed erroneous – it will need to be fixed.
Error 502 – Bad Gateway
This error is the result of a query that received an invalid response from the server. The causes of the problem can be several:
- Problems in the operation of the proxy server. To fix this error, try typing in the address bar of the browser a link to some other site. This way you can check if there is access to the Internet at all. If you find that there is Internet access, but your access to a particular site still gives error 502, try to delete the cookies in the browser.
- There is a shortage of server resources. This can mean that the load on the server exceeds the resources available at the selected hosting rate. Check with your hosting provider about tariffs with a large amount of resources and, if necessary, increase the RAM or the available disk space.
Error 503 – Service Temporarily Unavailable
Each account on the hosting server has a certain number of work processes allocated in accordance with the chosen tariff plan. Work with requests is in the order of the queue, they arrive on the server, where easy requests are processed instantly, and heavy ones are processed slowly. Each queue is limited to one or another number of requests. If the new request is outside this boundary, it will not be accepted and instead of the result the browser will issue an alert “Service is temporarily unavailable”.
To fix this error, you need to know the reasons why it may appear:
- Hanging scripts when sending large static files through PHP. Scripts work for a certain time, not permanently. When the script runs out, the transfer of the file is interrupted, the file will not be transmitted in full, and the request will leave the web server process running for a long time. You can correct the error through the following steps:
- Check all the components and plug-ins of your CMS, disconnecting them in turn, and find the heaviest or most spoiled, during which the downloading of the site slows down. If possible, discard such components, or look for a faster analog.
- Check if you have slow queries-the mysql-slow.log file is created in the logs folder of your account. The information in this file is updated once a day and contains only the most problematic SQL queries.
- If you use Include functions in PHP scripts that load parts of the engine that are located on the same account, make sure that they use the local path, not the URL of the form ” http: // …” . The presence of the URL causes the server to make an additional HTTP request – this takes unnecessary time and greatly slows down the site load.
- A large number of requests to the server. There are several reasons for such requests:
- The loaded resource is broken / contains links to too many files (images, stylesheets, JS scripts) that are loaded through individual requests. In this case, you should merge resources into one file, where possible.
- DDoS-attacks, floods, spam in the comment can also cause a large number of requests. In the case of a DDoS attack, it is necessary to determine its type, and, according to its level, take corrective actions. More details about what to do if your site is under DDoS-attack, we wrote in one of the articles of our blog.
Action when an error occurs
The listed errors can occur quite often, so knowing the reasons for their occurrence and the methods of elimination will help you solve the problem yourself, saving time waiting for a response and searching for a reason for technical support.