Stop SERPS from indexing 'showtemplate=false' pages

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
Forum Members
Forum Members
Posts: 64
Joined: Wed Feb 11, 2009 6:30 pm
Location: Toronto, Canada

Stop SERPS from indexing 'showtemplate=false' pages

Post 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:
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!
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

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

Post by psy »

Thanks for the tip. Maybe I'm wrong but I was under the impression that '&showtemplate=false' was deprecated?
Post Reply

Return to “Tips and Tricks”