• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Resolved Not seeing X-Robots-Tag from .htaccess

SlimDeluxe

New Pleskian
Server operating system version
Ubuntu 20.04
Plesk version and microupdate number
Obsidian 18.0.55
Hi,
I have the following in .htaccess:
Apache config:
<Files ~ "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

This works fine in local development. I can see the header.
However, when in production, the header is not there. Please see attached image.

What is the reason behind this and how can I fix this? :)

I checked the Logs and there's no error when accessing a PDF file, so I suppose there's no problem with the .htaccess directive. It's just ignored. Other directives from the same .htaccess work ok.

Any help would be appreciated.
 

Attachments

  • 2023-10-16_10-00.png
    2023-10-16_10-00.png
    58.7 KB · Views: 1
Ah, sorry, I forgot that this is served by nginx.
The solution is to set this custom nginx directive in "Additional nginx directives" under Hosting settings for the domain.
NGINX:
location ~* \.pdf$ {
    add_header X-Robots-Tag "noindex, nofollow";
}
 
Back
Top