• 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

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