Google is scanning my website on Go开发者_JAVA技巧ogle including a query string I don't want it to scan. For example: Their is a page - "/name.html" and in the URL it has a query string - "/name.html?qs=1". I don't want Google to include "?qs=1" in their index, because this query string isn't necessary and it'll create a lot of duplicates and trash when searching for my website on Google.
How can I disable Google's ability to index this query string and delete pages that had already indexed like this?
You should use robots.txt to do this.
Here is an example :
user-agent: *
disallow: /name.html?
This will block any call to name.html with a query string, but will index your name.html.
There is also this version :
user-agent: *
disallow: /name.html?qs=
This will block any call to name.html with the parameter "qs" contained in your query string, but will index anything else.
You have to make a robots.txt file in the root of your website.
User-agent: *
Disallow: qs
# Googlebot allows regex in its syntax
User-Agent: Googlebot
Disallow: /*?qs*
精彩评论