Unpublished pages should return a 404, not a 403

Created on 27 January 2025, 3 months ago

Problem/Motivation

The default behavior for Drupal is to provide a 403 error when an anonymous user visits an unpublished page.

In Drupal CMS, 403 errors are automatically redirected to the user/login page as a nicety for admins, but this could lead to confusion for sites that archive/unpublish pages as there is no reason given.

Google will also take longer to de-index pages with a 403 error, as 404 or 410 errors are what they use to remove content from their index. See: https://support.google.com/webmasters/answer/9689846?hl=en#make_permanent

Steps to reproduce

Install Drupal CMS with the blog recipe.
Visit https://drupal-cms-dev.ddev.site/node/4/edit
Change State to Unpublished and save
Logout or visit https://drupal-cms-dev.ddev.site/blog/2025-01/celebration-drupal-and-ope...
Verify you are taken to the Drupal login screen

Proposed resolution

Install the https://www.drupal.org/project/unpublished_404 β†’ module to the drupal_cms_authentication recipe.

User interface changes

N/A

Data model changes

N/A

Release notes snippet

Drupal CMS now emits a 404 (Not Found) error when a user tries to access a draft or unpublished node instead of the default Drupal core behavior of emitting a 403 (Access Denied).

πŸ› Bug report
Status

Active

Component

Track: SEO

Created by

πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024