When an external or guest user navigates to an invalid URL on a Salesforce Site (previously known as Force.com Sites) or an Experience Cloud Community, Salesforce redirects the user based on the site's login configuration:
/randomName.html) and login is enabled, the user is redirected to the Authorization Required page (HTTP 401)./randomName, where randomName does not match any existing Visualforce page or Lightning Community path), Salesforce always redirects to the Page Not Found page (HTTP 404).This behavior is working as designed.
This behavior applies to guest users of Salesforce Sites (previously known as Force.com Sites) and Communities, including Experience Cloud sites.
A redirect to the Authorization Required page (HTTP 401) may also occur when there are errors processing a valid resource request (such as /MyVisualforcePage), not just invalid URLs. In this case, enable debug logs for the Site Guest User and troubleshoot as you would for any Apex or page rendering error. If the issue cannot be resolved, contact Salesforce Support for assistance.
| Request Type | Login Enabled | Redirect Target |
Invalid resource with file extension (e.g., /page.html) | Yes | Authorization Required (401) |
Invalid resource with file extension (e.g., /page.html) | No | Page Not Found (404) |
Invalid page path without extension (e.g., /randomPage) | Either | Page Not Found (404) |
| Valid resource with processing error | Yes | Authorization Required (401) |
000384636

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.