Skip to content

Instantly share code, notes, and snippets.

@dotrungquan
Forked from khoipro/.htaccess
Created September 12, 2023 04:15
Show Gist options
  • Save dotrungquan/b471ae94792b3c895879fb5c401db8cc to your computer and use it in GitHub Desktop.
Save dotrungquan/b471ae94792b3c895879fb5c401db8cc to your computer and use it in GitHub Desktop.
Server config rules for set X-Robot-Tags
# For Apache, Litespeed
<Files ~ "\.(pdf|doc|docx|xls|xlsx|ppt|pptx)$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>
# nginx domain config
# example path: /etc/nginx/conf.d/domain.com.conf
server {
# Set X-Robots-Tag cho các file văn bản
location ~* \.(pdf|docx|doc|xls|xlsx|ppt|pptx)$ {
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment