DEV Community

Daniele Scasciafratte
Daniele Scasciafratte

Posted on • Originally published at daniele.tech on

How to set X-Robots-Tag in htaccess for any query string

It is just a note for me to remember this trick:

RewriteCond %{QUERY\_STRING} . RewriteRule .\* - [E=MY\_SET\_HEADER:1] [QSD,R=302,L] 
Header set X-Robots-Tag "noindex, nofollow" env=MY\_SET\_HEADER
Enter fullscreen mode Exit fullscreen mode

It is based on the suggestion here but with a change to support if there is any query string in the URL. [...]

Read More...

The post How to set X-Robots-Tag in htaccess for any query string appeared first on Daniele Mte90 Scasciafratte.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs