501

Not Implemented

Oficiālais
Pašlaik nav ieviests

Statusa koda 501 vispārīgs skaidrojums

Šis teksta bloks diemžēl ir pieejams tikai angļu valodā.

The HTTP error 501 Not Implemented occurs when a web server receives a request from a client that requests a function or feature that the server does not support or implement. The server recognises the request but cannot execute it because it does not have the necessary functions or resources. This can happen, for example, when a client uses an HTTP method that the server does not support, or when the server uses an older version of HTTP that does not support certain features available in a newer version.

A practical example of the HTTP error 501 Not Implemented would be when a web server receives a request for an HTTP method that it does not support, such as the PATCH method for updating part of a resource. If the server has not implemented this method, it will return a 501 Not Implemented error to tell the client that the request cannot be executed. Another example would be if a client sends a request for a specific version of HTTP that the server does not support, such as HTTP/2 when the server only supports HTTP/1.1. In this case, the server would return error 501 Not Implemented to tell the client that it cannot execute the request.

.

HTTP statusa koda 501 specifikācija

501 Not Implemented statusa kods norāda, ka serveris neatbalsta pieprasījuma izpildei nepieciešamo funkcionalitāti. Tā ir atbilstoša atbilde, ja serveris neatpazīst pieprasījuma metodi un nespēj to atbalstīt nevienam resursam. Pēc noklusējuma 501 Not Implemented atbilde ir kešējama, t. i., ja vien metodes definīcijā vai skaidrā kešatmiņas kontrolē nav norādīts citādi.

Avots / citāts no: 501 Not Implemented HTTP statusa kods ir norādīts 6.6.2 sadaļā 6.6.2.

Kā, izmantojot PHP, ievadīt 501 statusa kodu?

Lai tīmekļa lapā norādītu HTTP statusa kodu 501, var izmantot PHP funkciju http_response_code. Sintakse ir šāda: http_response_code(501) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Pārbaudīt 501 HTTP statusa kodu

Lai klienta pusē varētu attēlot HTTP statusa kodu (šajā gadījumā 501 Not Implemented) un citu informāciju, ar F12 ir jāatver izstrādes konsole. Pēc tam dodieties uz cilni "Tīkls". Tagad lapu var atvērt, tīmekļa vietnei (piemērs index.php) jābūt redzamai tīkla cilnē. Tā ir jāizvēlas un pēc tam jāizvēlas sadaļa Herder. Pēc tam lietotājs redzēs šādu rezultātu:

Statusa kods 501 Not Implemented
Pārskats
URL: https://http-statuscode.com/errorCodeExample.php?code=501
Statuss: 501 Not Implemented
Šie: Network
IP adrese: XX.XX.XX.XX
Statusa kods 501 Not Implemented

Kā atrisināt problēmu ar 501 statusa kodu?

Serveris atdod HTTP statusa kodu 501 Not Implemented, lai norādītu, ka pieprasītā metode nav atbalstīta vai nav ieviesta. Tas nozīmē, ka serveris nevar apstrādāt konkrēto pieprasījumu, jo pieprasītā funkcionalitāte nav pieejama. Lai atrisinātu HTTP statusa koda 501 Not Implemented problēmu, varat veikt vairākus soļus:

  1. Pārbaudiet izmantoto HTTP metodi: Pārliecinieties, vai pieprasījumam tiek izmantota pareizā HTTP metode. HTTP piedāvā vairākas metodes, piemēram, GET, POST, PUT, DELETE utt. Var tikt atgriezts statusa kods 501 Not Implemented, jo serveris neatbalsta pieprasīto metodi. Pārbaudiet servera API specifikācijas vai dokumentāciju, lai pārliecinātos, ka izmantojat pareizo metodi.
  2. Pārbaudiet servera konfigurāciju: Serveris var atgriezt statusa kodu 501 Not Implemented, ja dažas funkcijas vai moduļi nav iespējoti vai konfigurēti pareizi. Pārliecinieties, ka serverī ir iespējoti visi nepieciešamie moduļi un funkcijas, lai pareizi apstrādātu pieprasījumu. Pārbaudiet servera konfigurācijas failus, piemēram, Apache konfigurācijas failu (httpd.conf) vai Nginx konfigurācijas failu (nginx.conf), lai pārliecinātos, ka viss ir iestatīts pareizi.
  3. Atjauniniet servera programmatūru: dažreiz statusa kods 501 Not Implemented var parādīties, ja izmantotā servera programmatūra ir novecojusi un neatbalsta pieprasīto funkcionalitāti. Pārliecinieties, vai izmantojat jaunāko servera programmatūras versiju un vai ir instalēti visi pieejamie atjauninājumi. Tas var novērst zināmās problēmas un pievienot jaunas funkcijas, kas iepriekš nebija ieviestas.
  4. Konsultējieties ar servera dokumentāciju: pārbaudiet oficiālo servera vai izmantotās sistēmas dokumentāciju, lai iegūtu informāciju par 501 Not Implemented. statusa kodu. Dokumentācijā var būt iekļauti konkrēti norādījumi vai norādes, kā novērst problēmu. Meklējiet sadaļas par problēmu novēršanu, zināmām problēmām vai konkrētiem konfigurācijas iestatījumiem, kas jāpārbauda.

Svarīgi atzīmēt, ka HTTP statusa koda 501 Not Implemented problēmas atrisināšana lielā mērā ir atkarīga no konkrētās servera konfigurācijas, izmantotās programmatūras un pieprasījuma veida. Tomēr iepriekš minētie soļi ir vispārīgs ceļvedis problēmas risināšanai un iespējamo risinājumu meklēšanai.

.

Kā izveidot savu kļūdas lapu statusa kodam 501

Gan ar Apache, gan NGINX tīmekļa serveriem ir salīdzinoši viegli izveidot savu 501 Not Implemented. kļūdas lapu.

Apache Webserver

Tīmekļa serveris "Apache" ir viens no visizplatītākajiem tīmekļa serveriem internetā. Lai "Apache" serverī izveidotu savu 501 Not Implemented. kļūdas lapu, šajā failā jāveic šādas izmaiņas.

File: .htaccess
ErrorDocument 501 /errors/501.html

NGINX Webserver

Līdzīgi kā tīmekļa serveris "Apache", arī "NGINX" tiek plaši izmantots internetā. Lai izveidotu savu 501 Not Implemented. kļūdas lapu "NGINX" serverī, ir jāveic šādas izmaiņas šajā failā.

File: sites-enabled/default
error_page 501 /501.html;
location = /501.html {
    root /usr/share/nginx/html;
    internal;
}

501 statusa koda saderība ar pārlūkprogrammu

Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data

Konstantes programmēšanas valodās

HttpStatusCode.NotImplemented
http.StatusNotImplemented
Response::HTTP_NOT_IMPLEMENTED
httplib.NOT_IMPLEMENTED
http.client.NOT_IMPLEMENTED
http.HTTPStatus.NOT_IMPLEMENTED
:not_implemented

Izklaidējošas memes par HTTP statusa kodu 501

Autors: Tony Brüser
Autors: Tony Brüser

Tonijs Brūsers ir aizrautīgs tīmekļa izstrādātājs, kurš aizraujas ar HTTP statusa kodiem.

LinkedInGitHub