deindex_unpublished_files
The Deindex Unpublished Files module ensures that files associated with unpublished media are not publicly accessible. It achieves this either by adding a prefix to the file URL or by moving the file to the private files directory (private://unpublishedfiles), helping protect unpublished files from being exposed or indexed by search engines.
The module functions only with media types that include a file field.
Installation
Place the deindex_unpublished_files module folder into modules/contrib.
Clear Drupal caches if necessary.
Visit the configuration form at:
Configuration → Media → Unpublished files settings (if the module is enabled).
Configuration
Choose the method to make unpublished media files inaccessible:
Prefix method: Adds a URL prefix to prevent access.
Private files method: Moves the file to a private directory (private://unpublishedfiles).