Page 1 of 1

Stop SERPS from indexing 'showtemplate=false' pages

Posted: Mon Dec 17, 2012 12:43 am
by caciavar
I have a site that uses jquery and ajax to display the results of the form without using ajax. In order to display the results of the form in a div, I am using '&showtemplate=false' at the end of the URL to display only the results of the form and not the entire page within the output div.

Because of this, Google has index 2 copies of all of my pages - the template pages and the non-template pages.

If I search for this in the google search box: sitename:mysite.com
I see all of the pages that google has index.

I could have prevented google from indexing the 'showtemplate=flase' versions of my pages by including this in my .htaccess file:

Code: Select all

# Stop SERPs from indexing 'showtemplate=false' pages

#modify query string condition here to suit your needs
RewriteCond %{QUERY_STRING} (^|&)showtemplate=false [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" env=MY_SET_HEADER
Ah well... live and learn!

Re: Stop SERPS from indexing 'showtemplate=false' pages

Posted: Mon Dec 17, 2012 9:57 am
by psy
Thanks for the tip. Maybe I'm wrong but I was under the impression that '&showtemplate=false' was deprecated?