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.

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up