451

Unavailable For Legal Reasons

Official
Due to legal reasons the request has been rejected

General explanation of the 451 status code

The HTTP status code 451 Unavailable For Legal Reasons is used to indicate that a resource is unavailable due to legal reasons. This may be the case, for example, if a government agency or court has ordered the removal of or access to a particular website or resource due to laws or regulations.

The HTTP status code 451 Unavailable For Legal Reasons can be used to indicate that a resource is unavailable due to the European Union's General Data Protection Regulation (GDPR). The GDPR gives individuals the right to request that their personal data be deleted if it is no longer needed or has been unlawfully processed. If a company or organisation receives such requests and the resources in question are no longer available due to the GDPR, the HTTP status code 451 Unavailable For Legal Reasons can be used to indicate this.

Specification of the HTTP status code 451

This status code indicates that the server is denying access to the resource as a consequence of a legal demand.

The server in question might not be an origin server. This type of legal demand typically most directly affects the operations of ISPs and search engines.

Responses using this status code SHOULD include an explanation, in the response body, of the details of the legal demand: the party making it, the applicable legislation or regulation, and what classes of person and resource it applies to.

For example:

HTTP/1.1 451 Unavailable For Legal Reasons Unavailable For Legal Reasons
Link: ; rel="blocked-by"
Content-Type: text/html

The use of the 451 Unavailable For Legal Reasons status code implies neither the existence nor nonexistence of the resource named in the request. That is to say, it is possible that if the legal demands were removed, a request for the resource still might not succeed.

Note that in many cases clients can still access the denied resource by using technical countermeasures such as a VPN or the Tor network.

A 451 Unavailable For Legal Reasons response is cacheable by default, i.e., unless otherwise indicated by the method definition or explicit cache controls; see [RFC7234].

Source / Quote by: The 451 Unavailable For Legal Reasons HTTP Status Code is specified by section 3 of RFC7725.

How to throw a 451 statuscode with PHP?

To throw the HTTP status code 451 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(451) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 451 HTTP status code

In order to be able to display the HTTP status code (in this case 451 Unavailable For Legal Reasons) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 451 Unavailable For Legal Reasons
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=451
Status: 451 Unavailable For Legal Reasons
Those: Network
IP address: XX.XX.XX.XX
Status code 451 Unavailable For Legal Reasons

How to create a custom error page for the 451 status code

Creating your own 451 Unavailable For Legal Reasons error page is relatively easy with the web server "Apache" as well as with the web server "NGINX".

Apache Webserver

The web server "Apache" is one of the most popular web servers on the Internet. To create an own 451 Unavailable For Legal Reasons error page in "Apache", the following change must be made in the following file.

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

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 451 Unavailable For Legal Reasons error page in "NGINX", the following change must be made in the following file.

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

Browser compatibility of the 451 status code

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

What SEO impact does the 451 status code have?

First of all, it is important to understand that search engines, especially Google, are constantly trying to provide the best possible user experience. This means that they are constantly adjusting their algorithms to promote high-quality, relevant, and accessible content. An HTTP 451 Unavailable For Legal Reasons status code sends a clear signal to search engine bots that the content is inaccessible for legal reasons.

Directly after the implementation of the 451 Unavailable For Legal Reasons status code, websites that returned this code were downgraded in search results or removed entirely. There is a good reason for this: when a user clicks on a link in the search results and is taken to a page that is not available, it leads to frustration. Search engines want to avoid this negative user experience, so they react negatively to the 451 Unavailable For Legal Reasons status code.

In the long run, repeated use of the 451 Unavailable For Legal Reasons status code for different resources on a website can cause search engines to rank that website as less reliable or less valuable. This, in turn, can affect the overall SEO performance of the website.

Another indirect effect involves backlinks. Links from other websites are an important factor in search engine rankings. However, if a piece of content frequently returns the 451 Unavailable For Legal Reasons status code, websites that have linked to that content might decide to remove the link so as not to affect the user experience of their visitors. This would further reduce the value and trust in the website.

However, there are strategies website owners can use to minimize the negative impact of the 451 Unavailable For Legal Reasons status code on SEO. One option is to provide clear and informative error pages that explain to users the reason the content is unavailable and offer alternative resources or courses of action.

Constants in programming languages

http.StatusUnavailableForLegalReasons
Response::HTTP_UNAVAILABLE_FOR_LEGAL_REASONS
:unavailable_for_legal_reasons
Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub