1

Will below Disallow function will block every URL which has "?" in it?

Disallow: /*?*PrintPage=yes*

I was actually checking few pages with "?" in them and they were not indexed in Google and then I saw some other URLs with "?" and they are indexed in Google.

Why is this happening, also these "?" pages don't have noindex tag or canonical tag.

3
  • @unor you have edited OP robots.txt by mistake I think, but my answer is based on original post. Hope it's fine.
    – Goyllo
    Jan 18 '17 at 17:14
  • @Goyllo: Ah, didn’t notice this (I didn’t add the *, but made them visible with the code markup). But I assume that OP actually intended to use the three * characters there, instead of using the italics formatting (for example, so that "PrintPage" doesn’t have to be the first parameter in the query component).
    – unor
    Jan 18 '17 at 17:17
  • Yeah got you after I click on edit option. It was not visible due to bad code markup, thank you @unor
    – Goyllo
    Jan 19 '17 at 5:34
1

No, it does not block all webpages that have ? in URL.

Disallow: /*?*PrintPage=yes*

This will block below kind of pages for example.

www.example.com/sometext?xPrintPage=yes.html
www.example.com/123?PrintPage=yes.php
www.example.com/Some-123?xyz-PrintPage=yes/another-page/

Did you notice anything? That rule will block only those pages that contain ? and PrintPage=yes, In that rule, you can add any characters before and after ? . Same thing will apply to *PrintPage=yes* as well.

To block every webpage that have ? in URL, you have to use * in both front and end side like this

Disallow: /*?*

I strongly recommended you to checkout this Google reference about robots.txt.

1
  • Thanks Goyllo for the answer, I was thinking same that it should not block all the URLs with "? " but then when I couldn't find those URLs in Google index I got confused. Anyways thanks for clearing it. Thanks.
    – NRose
    Jan 19 '17 at 19:05
0

If you want to block pages with parameters the best way to do it is with Google search console under Crawl > URL Parameters. This will remove the pages pretty quickly and will likely improve your overall rankings.

1
  • Thanks Roie Speiser for the reply, yes I intend to do that.
    – NRose
    Jan 19 '17 at 19:05

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.