riasvdv / statamic-redirect

Redirect allows you to redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
https://statamic.com/addons/rias/redirect
19 stars 21 forks source link

Redirect loop #166

Open j-jalving opened 5 months ago

j-jalving commented 5 months ago

When editing the slug of an entry a redirect is automatically created. Is this done by the plugin or by Statamic?

Either way, it seems to be causing some issues. Sometimes I notice after renaming the slug and visiting the page, I get caught in a redirect loop. You can see it in this example where the slug kennis has been renamed to kennisbank:

Screenshot 2024-01-22 at 14 06 01

I think this might be caused by a faulty regex. As you can see it just keeps adding everything after kennis over and over again.

faltjo commented 3 months ago

I have observed the same behaviour. Redirects which are created automatically on change of an entry use match_type regex and the capture group is appended at the end of the redirect, which can lead to such loops.

Take this example: /test(.*) redirects to /test-new-url$1, now visit /test-. It will lead to something like /test-new-url-new-url-new-url-new-url-new-url-new-url-new-url... and so on in the address bar and eventually chrome will tell you that the page is broken (ERR_TOO_MANY_REDIRECTS).