Issue with .htaccess redirects

I was setting up redirects in my .htaccess like this

Redirect 301 /go/external

I put like 20 different redirects for different external pages at the end of the file.
And now I have the problem that going to my homepage redirects me to /go/external, even after I removed all redirects again, thinking this would fix the problem. I’m developing locally using XAMPP.

How do I fix this issue and configure redirects that actually work and don’t break anything?

Well, I fixed it somehow, by setting a single redirect to

Redirect /go/external /

Even after removing this line again from my .htacces, the fix stays.

But still, why did this happen and how to I set up redirects correctly with Kirby?

The setup of redirects is indeed not Kirby related, it is subject of your webserver configuration. However it is impossible to tell why this did happen for you without knowing your complete webserver configuration.

It has been written multiple times even in this forum, that one has to be careful with 301 redirects, which are permanent and will be cached by the clients browser. Somehow, I guess, you have added a redirect from your homepage to go/external, but simply removing this permanent redirect from your webserver configuration does not affect browsers which might have already cached this redirection. But unintentionally you did the right thing by adding a reverse redirection configuration. When a browser, which has already cached the original redirection is confronted with the reverse one, it will either give a warning of possible redirection loop or just removing the original redirection from its cache, if not both.

Some other ways to mitigate this issue:

  • Do not use 301 but 302 redirects (Redirect /go/external / is a 302 or “temporary” redirection)
  • Clear your browsers cache. Obviously, this will only work for you but not for someone else.
  • Revisit the site in a private window. This will change nothing with your usual browser but you can use it as a workaround.
  • Add a reverse redirection. This will remove the orignal redirection from your visitors browser cache, but it can also lead to ugly error messages depending on the browser/version. On the other hand, this will also remove the original entry from search engines, which will also honor a 301 redirect by changing the original hit with the redirected one.

I see. Thank you for clarifying! I’m going to look into what could have went wrong in my configuration.