Redirects are not working properly

When using the redirect YAML file, I get some sort of loop on the final URL.

My website is: yourdaily.tech
Ghost version: v5.58.0
Install: DigitalOcean OneClick
Update: CLI via SSH

I have made the routes on my website slightly different from /post to /year/month/tag/post

However, when I try to update the redirects from the old URL I get a crazy long URL and a “ERROR TOO MANY REDIRECTS” page.

How to properly use either YAML or JSON to fix this issue?

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

  • What’s your URL? This is the easiest way for others to help you
  • What version of Ghost are you using? If it’s not the latest, please update Ghost first before opening your topic

And

  • How was Ghost installed and configured?
  • What Node version, database, OS & browser are you using?
  • What errors or information do you see in the console?
  • What steps could someone else take to reproduce the issue you’re having?

post your redirect.yaml file for help, please!

301:
  /with-microsoft-their-integration-of-openai-s-chat-gpt-start-using-bing-webmaster-tools/: /2023/03/microsoft/with-microsoft-their-integration-of-openai-s-chat-gpt-start-using-bing-webmaster-tools
  /how-to-setup-google-analytics-4-ga4-in-shopify/: /2023/03/shopify/how-to-setup-google-analytics-4-ga4-in-shopify

Are your redirects reversed? It’s incoming url, then final destination.

Yes the old URL first, and then the new URL second.

I started the website with the base url, so domain/post-url.

And then I went to domain/year/month/tag/post-url

However it seems that the new URL comes with a never ending loop

Ah. So start the old url with ^ , which pins the match to the start of the line. :)

And then be sure those destination urls actually work on Ghost, by updating routes.yaml if you haven’t already.

I actually did that, and still getting this error:

301 redirects can be cached. Try another browser or another computer, see if the problem is fixed. :)

AWESOME! You’re the best. I am updating all my links now :) :grin:

1 Like