I was trying to redirect my landing page, and ended up sending my posts into a redirect loop. I uploaded a new redirects.yaml. It didn’t work, and I got stuck in a redirect loop:
In local development, I was able to resolve this by restarting Ghost (ghost restart using the CLI tool). In my production Ghost Pro site, I haven’t been able to find any way to fix this at all. What are we supposed to do when this happens, exactly? The docs say that uploading an empty redirects.yaml file will remove all redirects, but that clearly isn’t true if these infinite loops get stuck and stay there regardless.
If you upload a redirects file with a 301 redirect, you are creating a permanent redirect.
The 301 status code tells everything between you and Ghost: your browser, your ISP, your server etc that they can cache that 301 status forever.
If you upload a new file without the 301 redirect, Ghost removes the redirect, but all the hops between you and it have no way to know they’re not supposed to serve that cached 301 anymore. So you’ll need to clear your browser cache, and any caches on your server… and even then it can still persist.
If you’re having this problem with a Ghost(Pro) site specifically, then you’ll need to reach out to support to help clear some of the intermediary caches.
The ^ means start of line, and the $ means end of line.
However, if what you’re trying to do is to serve a special page at /, you should probably be looking at routes.yaml instead. Have a look here: Ghost Themes - Dynamic URLs & Routing