php - correct htaccess query string code -


is correct code htaccess setting header noindex nofollow

 rewritecond %{query_string} (^|&)cart? [nc]   rewriterule .* - [e=my_set_header:1]   header set x-robots-tag "noindex, nofollow" env=my_set_header 

so following url cannot indexed search engines.

http://www.mysite.com/cart?qty=1&id_product=8&token=7775324f4cd8c884155af53ca90e44ad&add

actually moz analytics crawling these types of url in <a href="http://www.mysite.com/cart?qty=1&id_product=8&token=7775324f4cd8c884155af53ca90e44ad&add">add cart</a>

as duplicate page content. dont know why these url add cart url , these nothing content.

also need suggestion online tutorial on playing htaccess .

thanks.

/cart isn't query_string request uri. can use rule instead:

rewritecond %{query_string} .+ rewriterule ^cart/?$ - [e=my_set_header:1] 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -