If I setup a 301 redirect for the first URL path below will that also redirect all the paths below that contain a query string?

For example:


redirects to


Note: I don't need to pass the query string here so I only need to redirect the first URL path?

  1. /6-light-oval-chandelier-espresso
  2. /6-light-oval-chandelier-espresso?pp=0&epik=dj0yJnU9MTN
  3. /6-light-oval-chandelier-espresso?pp=0&epik=dj0yJnU9QnF
  4. /6-light-oval-chandelier-espresso?pp=0&epik=dj0yJnU9Ujl
  • I'm not really sure what your question is? Other than, potentially "yes". But it can depend on how you implement the redirect. However, your "example" seems to be doing the opposite and removing the query string? If you try to do both, you may end up with a redirect loop?
    – MrWhite
    Oct 10, 2019 at 23:53
  • 1
    A note on terminology... in all those URLs, the URL-path is /6-light-oval-chandelier-espresso. The query string is not part of the "path" as you imply... "all the paths below that contain a query string" - the "path" (as in "URL-path") does not contain the query string. The "URL" contains the query string.
    – MrWhite
    Oct 10, 2019 at 23:59
  • What exactly are you trying to achieve here?
    – MrWhite
    Oct 15, 2019 at 22:34

1 Answer 1


To answer your questions properly you should paste the code you are using for the redirect first, however I won't do that, check below for what I believe you should do.

You don not need to implement a 301 redirect here, that could complicate things more in the future. Besides that, how many redirects would you need?

I would suggest to implement a combination of either canonical meta tag or using robots.txt to block bots from crawling those pages if parameters are/become accessible somehow. If you have to pick one, I would suggest to use canonical over robots.txt

Canonical Tag (highly recommended)

On The Page: https://example.com/6-light-oval-chandelier-espresso?pp=0&epik=dj0yJnU9MTN

Use Canonical:

<link rel="canonical" href="https://example.com/6-light-oval-chandelier-espresso" />

Or robots.txt

Disallow: /sample-folder/
Disallow: /sample-page.php
Disallow: /*?pp=

Important Note: Test your robots before deploying

  • 1
    If you have a robots.txt disallow in place for a page, the canonical tag will never be seen as searchers will never crawl that specific URL. You should use just the canonical tag :)
    – Emirodgar
    Oct 11, 2019 at 7:18
  • @Emirodgar you are 100% right, I was trying to ilústrate that you could do either technique or use both for the same purpose, no for the very same issue. But to avoid confusion I will edit The Anwser better. thanks.
    – Raul Reyes
    Oct 11, 2019 at 7:24

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.