'If the url contains a question mark, NOindex

I want to noindex if my URL has the following parameters, but I couldn’t.

domain.com/?blablatopic

domain.com/#blablatopic

I want to noindex if there are these 2 characters (? and #) in the URL.

I want to do it with .htaccess.(x-robots-tag) but I couldn't do that. Please help me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source