0

So this is my case..

  • I have a Custom Post Type with slug /event
  • I have this plugin installed - Redirection
  • On the said plugin, I have a Redirection entry ^/event/(.*)/?$ which would redirect to /shows-events/$1

Now, when I try to access a custom post type or a page with /event/ on its URL, its giving me error Redirected you too many times

Can somebody explain why this is happening? Why can't the link just redirect me to /shows-events/ URL?

Thank you in advance!

3
  • WP will redirect URLs to their canonical versions to avoid SEO penalties, it sounds like once this is done the redirection plugin kicks in and redirects you back, leading to an infinite loop. If you want to change the event post type to use shows-events instead a redirection plugin is not the solution you were hoping for, and answering the question as you've asked it will lead to content duplication penalties that are avoidable. This is a classic X Y problem where you've asked how to I fix my solution Y ( the redirect plugin ), rather than how to change the CPT rewrite slug
    – Tom J Nowell
    May 17 at 13:21
  • Thank you! This was very helpful. The redirect plugin solution was actually because of client requirements wherein they need some migrated content to redirect to shows-events and still keep the CPT's slug to event. To resolve this we just changed the CPT slug to events
    – ensaymada
    May 17 at 14:05
  • can you write that up as an answer below for other people with this question?
    – Tom J Nowell
    May 17 at 14:10

1 Answer 1

0

Thanks to Tom, I understood how this works...

  1. I did not have any pages with the URL /shows-events/ so there is nowhere to redirect to
  2. When the user accesses the existing page /event/, it triggers a redirect to /shows-events/ (which does not exist), but because of WordPress' canonical redirect, it returns to the existing URL /event/, which then causes an infinite loop

To resolve this, you may either:

  1. Remove the redirection entry
  2. or change your CPT slug
  3. or create a page with your target redirect URL

A useful tool when tracking URL redirects: https://wheregoes.com/

Your Answer

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

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