404 pageBy sending HTTP requests to the server, the browser may receive an unpleasant status with an error code instead of the expected content. By knowing this code, you can determine why the request cannot be processed by the server. Let’s consider the basic reasons of appearing of such errors, and how to eliminate them independently.

About internal errors

If you can’t open a website and instead of a page, your browser says that HTTP error 500 has occurred, it means that an internal server error has been detected. The reason for this is the failure of the hosting software, which causes a problem with the processing of user requests to the server.

In this case, the guilty one is the provider itself, or the owner of the site, which made an error in the code (scripts) or configuration of the server settings. The webmaster or hosting provider should solve the problem. So try to visit the resource a little later, when the owner will detect the error and fix it.

Types of errors

The HTTP protocol errors appear when Apache cannot process a client request and return the requested documents to the browser. Instead, the server returns various HTTP state codes to the user. Which are displayed in the browser instead of the site pages?

The list of HTTP status codes is divided into types, depending on the response result:

– 2xx – indicates the successful status of the request;

– 3xx – positive status, about the successful forwarding of the request;

– 4xx – indicates errors on the client’s side, which the server for some reason can not process or accept HTTP request;

– 5xx – internal errors on the server side, due to which requests are not executed or sites are unavailable;

Each status has 3 numbers, the first one determines the cause, two xxx determine the error code so that users can understand how to fix it. The site owners are most interested in the 4xx and 5xx groups. Most of them are insignificant and can be solved by the user himself.

Error 400

When you try to open a website, your browser may display a page: 400 Bad Request. This means that the server found the incorrect syntax in the user’s HTTP request and considered it to be a bad request by issuing page 400. The error is most often caused by:

  • bad internet connection;
  • large amount of cookies and data in the browser cache;
  • browser blocking by antivirus or Windows Firewall ;

The first thing associated with the appearance of error 400 is a problem with the network. To fix it, just reconnect to the Internet or wait for a good connection.

If this does not help, try clearing the cache and cookies in your browser, then refresh the page. Because the session can store old logins, passwords, and other data that prevent the browser from sending the correct HTTP request to the server.

Also, check if the browser is blocked by your antivirus and firewall. Try to disable them and refresh the page.

Error 403

Why does the site have an error 403 and how to fix it? The owner of the site or the server settings may restrict access to the directories on the server, due to which some pages and files may not be available. The server accepts HTTP requests but refuses to execute it, so you see the page: 403 Access is denied. It appears on the client side, but only the owner of the resource can eliminate it.

How do I fix the origin of a 404 page if I am the owner of the site? Possible solutions:

  • You have uploaded an incorrect index file to the server. The home page file of your site should be called index.shtml, index.html, index.htm, index.phtml or index.php. Please note: all characters must be in lowercase (Unlike Windows, under Linux, which runs the server, the file name register has a value, and index.html and index.html are two completely different files).
  • You have set the wrong permissions for the folder where the requested file is located, or for any of its parent directories. All these directories must grant execution rights (x) to the owner.
  • You have uploaded the site files to the wrong folder. Go to your control panel under “Hosting / Domains / My domains” and see what is written in the “Folder” column opposite the domain you are interested in. This is the folder where you need to upload your site files.
  • In addition, the error 403 can occur when you transfer a domain from one account in the system “Gino” to another. In this case, you just need to wait a little – you need time to update the DNS cache.
  • If you think that all the rules above are met, but error 403 still occurs, please contact technical support.

Error 404

The most common error on any site is 404 not found. What does the error 404 mean? From the name, it is clear that the servers can not find the page or file you need. But the server itself works, responds and processes user requests.

What can a visitor do? Check if the URL of the requested document is specified correctly and if it is entered correctly in the address bar of the browser. If the link is correct and the browser outputs a 404 page, then the file has been moved or removed from the hosting.

How do I fix the origin of a 404 page for the owner of the site? Check if there is a ban on viewing the document, if so, then your visitors will see page 404. If you have deleted, moved or renamed folders and files, the old links to them will not work. As often the problem lies in configurations of your CMS system, which may form incorrect URLs of pages of the site.

Error 500

If your browser shows error 500 when trying to open the site, it means there was an internal server error. This prevents your HTTP request from being processed, or the site becomes unavailable. The most common cause of error 500 (Internal Server Error) is incorrect .htaccess file syntax or unsupported directives. More often than not, it is enough to comment on the Options directive (to do this, you need to put a grid at the beginning of the line – #) and the problem will disappear.

Error 500 may also occur due to incorrect handling of CGI scripts:

  • CGI scripts must have UNIX (\n) line endings, not Windows (\r\n). To do this, they must be uploaded to the server via FTP in ASCII mode.
  • CGI scripts and the folders where they are located should only be writable by the owner, i.e. they should have the rights 0755 (drwxr-xr-x).
  • CGI scripts generate incorrect HTTP response headers. In this case it is useful to refer to error_log (it can be found in the control panel under “Hosting / Statistics / Log Files / Errors”).

Error 502

What does 502 bad gateway error mean? Any web server that acts as a gateway between DNS and proxy servers. If the hosting server receives an invalid response from them, the browser instead of the site produces a 502 error. This can be seen when opening a site in a browser with the Internet turned off (see page 502). Or when the server is overloaded.

How to fix it:

  • check if you have a connection to the Internet;
  • check your hosting plan, if your disk space or RAM load may have been exceeded;
  • try clearing your browser cookies;

Or try to visit the site later, it is possible that DNS servers are temporarily unavailable and are sending incorrect responses to your browser.

Error 503

Each account on the server is allocated a certain number of processes-workers who process user requests. Requests come to the server and become a queue. Easy requests are processed quickly, and heavy, problem requests are processed slowly, slowing down the queue. When the queue length reaches a certain value, the server stops accepting new requests, returning error 503 (Service Temporarily Unavailable).

 

Below are the frequent causes of long queues, as well as ways to solve this problem:

Scripts are freezing.

  • Transferring large static files via PHP

Large static files are best transferred directly without using scripts. There are two reasons for this: first, the running time of the scripts is limited, after which the transfer of the file is interrupted; second, to transfer the file through PHP uses a separate process-working, and therefore it ceases to participate in the mechanism for processing requests from users.

To transfer files directly, on the contrary, a special multi-threaded process is used, which can handle multiple threads simultaneously, without affecting the speed of loading the site.

Functionality of many file storage scripts can be implemented through mod_rewrite rules in .htaccess file (for example, anti-lic system).

  • Connection to a remote server

It’s better to avoid. If you can’t do without it, you should set a small timeout to wait for an answer and make sure that the connection to the remote server is good enough.

If PHP scripts use Include-functions that load engine parts located on the same account, make sure that they use the local path and not the URL like “http://…”. The presence of the URL causes the server to make an additional HTTP request – it takes an extra work process and greatly slows down the loading of the site.

  • A large number of “heavy” or spoiled CMS components

Check all components and plug-ins of your CMS, disabling them one by one, and find the heaviest or the most spoiled, which slows down the load of the site. If possible, disable such components, or look for a faster analogue. Also uninstall all unnecessary components that you do not use or do not need to use.

  • Durable mambot task (for Joomla)

If there are tasks among the mambot that can be transferred to the system cron, it is best to do so. mambot tasks are executed together with the user request, so the loading of the site is very slow, or does not happen at all.

  • Mailing list

The start of the mailing script is best placed in the system cron, which is controlled in the control panel. And start it to assign the lowest load on the server (night Moscow time). At the same time, you should take into account the restrictions imposed by the terms of the contract-offer with respect to the number of mails per hour / day and operating time of the PHP-script.

  • Large number of slow queries to MySQL

If you have slow requests, a file mysql-slow.log 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.

  • Install cache components in the engine that could reduce the number of SQL queries.
  • Optimize SQL queries.
  • Index the database tables by the columns used in the sample.
  • If nothing helps, perhaps you should change the engine to a more optimal one.

Large number of queries to a web-server

  • The downloaded resource is split/contains links to too many files (pictures, JS-scripts style sheets), which are loaded through separate requests. Try to combine resources into one file where possible.
  • The site has an element that periodically sends AJAX requests (e.g. chat) to the server. The number of requests depends not only on the number of visitors, but also on their habit of opening several tabs in your browser.
  • Boot indexes that scan site resources (search engines, Sape and others).
  • Using resource elements or scripts on other sites (links to images, scripts-informers). Use anti-personal modules/settings.
  • DDoS-attacks.

 

Conclusion.

If you have problems with HTTP requests, you should always see what code the server returns to your browser. Then you can correctly identify the source of the problem and solve it in the shortest possible time.