1

I have a website example.com where I have a number of pages where comments can be made. Instead of using postback to post the comments back to the server, I use Ajax but it seems to have created additional pages.

http://example.com/page
http://example.com/page/postcomment 

It has indexed the postcomment page rather than the one without the postcomment. How can I prevent Google from indexing postback function calls?

1

Look here:

http://www.robotstxt.org/meta.html

It tells you how to make search engines to NOT index pages you don't want it to index.

All you need to do is insert this into the HTML of your http://example.com/page/postcomment page is this between <head> and </head>:

<META NAME="ROBOTS" CONTENT="NOINDEX">

And make sure such line is removed from http://example.com/page

Also, I think google wanted to index http://example.com/page/postcomment because based on the URL, it appeared more interesting than just http://example.com/page.

And, to increase the odds of a specific page being indexed, add a meta description and a unique title to the page.

  • 1
    I wouldn't expect an AJAX postback to be a full page. AJAX usually fetches HTML fragments, or JSON data that don't have a <head> section. – Stephen Ostermiller Dec 6 '16 at 16:39
  • Google can still index a page even though it's blocked by robots.txt – Alfred Wallace Dec 9 '19 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.