How to set the X-Robots-Tag HTTP header via .htaccess file based on URL query string
snippet in htaccess

How to set the X-Robots-Tag HTTP header via .htaccess file based on URL query string

user5649

#modify query string condition here to suit your needs
RewriteCond %{QUERY_STRING} (^|&)m=_\! [NC]
#set env var MY_SET-HEADER to 1
RewriteRule .* - [E=MY_SET_HEADER:1]

#if MY_SET_HEADER is present then set header 
Header set X-Robots-Tag "noindex, nofollow" env=MY_SET_HEADER