If I were to have a url like https://example.com/books, that contained several links to urls such as:




Would search engines crawl and index the content returned by these URLs? If not, what would happen if I were to use a rewrite rule in my .htaccess file to rewrite pretty urls to ugly ones with query strings:

https://example.com/books/foo -> https://example.com/books?id=foo

https://example.com/books/bar -> https://example.com/books?id=bar

https://example.com/books/baz -> https://example.com/books?id=baz

Would there be any difference/preference? Or would a search engine crawl both?

1 Answer 1


Yes. Query strings are part of the URL and as such are viewed as directing the robots to different pages.

There may be a preference to using a path because then Google can test the parent. So if you have:


Google will eventually test


on its own (it could be that they don't do it anymore though, but I'm sure I read that somewhere on a page owned by Google.)

One thing for sure, if you allow both, make sure to add a canonical meta tag with your preferred URL otherwise you could get penalized because of the duplication.

  • 1
    "There may be a preference to using a path because then Google can test the parent." - If Google should so choose, it can just as easily "test" without sending any query string parameters - so really there is no difference. The query string also has the "advantage" that you can fine tune how Google treats it within GSC.
    – MrWhite
    May 17, 2019 at 12:43
  • @MrWhite, well... only query strings don't systematically represent a path and just removing them you would just end up on the home (which I guess is fine too, but that's not really a new page per se, right?) I've not seen proofs that Google would test parent directories on its own yet, though. But I've seen it trying to run JavaScript and ending up checking weird pages. May 17, 2019 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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