What Is a 403 Status Code?
The server understood the request but refuses to authorize it.
A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).
If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.
An origin server that wishes to “hide” the current existence of a forbidden target resource MAY instead respond with a status code of 404 Not Found.
- Source: RFC7231 Section 6.5.3
403 CODE REFERENCES
Rails HTTP Status Symbol
Go HTTP Status Constant
Symfony HTTP Status Constant
Python2 HTTP Status Constant
Python3+ HTTP Status Constant
Python3.5+ HTTP Status Constant
Apache HttpComponents Core
403 status code example
Here is an example of a request and response for a 403 Forbidden status code:
GET /secret-page HTTP/1.1
HTTP/1.1 403 Forbidden
Date: Thu, 17 Mar 2023 12:00:00 GMT
Content-Type: text/html; charset=UTF-8
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<p>You do not have permission to access this resource.</p>
In this example, the client has requested access to a page called “/secret-page” on the server at “example.com”. However, the server has determined that the client does not have the necessary permissions to access the resource and has returned a 403 Forbidden status code in the response.
The response includes a message explaining the reason for the error, which in this case is “You do not have permission to access this resource”.
How to fix a 403 status code
A 403 Forbidden status code indicates that the client does not have the necessary permissions to access the requested resource on the server. To fix this error, you need to identify the reason why the server is denying access and take appropriate action to resolve the issue.
Here are some common reasons why a 403 status code may be returned and how to fix them:
- Incorrect permissions: Check the permissions of the requested resource and ensure that the client has the necessary permissions to access it.
- Authentication failure: If the resource requires authentication, check if the client is providing the correct credentials. If the credentials are incorrect, the server will deny access with a 403 status code. In this case, the client needs to provide valid authentication credentials to access the resource.
- IP blocking: The server may be configured to block requests from certain IP addresses. If this is the case, the client may need to contact the server administrator to request access or to remove the block.
- Access control list (ACL) restrictions: The server may have an ACL in place that restricts access to the resource. If this is the case, the client needs to check if they are on the allowed list or request access from the server administrator.
Once you have identified and fixed the issue, the server should allow the client to access the resource without returning a 403 Forbidden status code.
Does a 403 status code affect SEO?
A 403 Forbidden status code does not directly affect search engine optimization (SEO) because it is a valid response indicating that the client does not have the necessary permissions to access the requested resource. However, it can indirectly impact SEO if it prevents search engine crawlers from accessing important pages or resources on your website.
If search engine crawlers encounter a 403 Forbidden status code when trying to access a page or resource, they may interpret it as a signal that the page is not accessible to users and may lower the page’s ranking in search results. This is because search engines prioritize pages that are accessible and user-friendly, and a 403 status code can indicate that the page is not meeting these criteria.
In addition, a 403 status code may also impact user experience, which can indirectly impact SEO. If a user encounters a 403 error when trying to access a page or resource, they may become frustrated and leave your website, which can increase your bounce rate and lower your rankings in search results.
Overall, while a 403 status code may not directly impact SEO, it can indirectly affect it by preventing search engine crawlers from accessing important pages and resources, and by negatively impacting user experience.
- Learn about web development
- Learn about SEO
- Web development services from WebFX
- SEO services from WebFX
- MDN Web Docs