"Soft" language redirect?

The _redirects feature based on language, for example:
/ /fr 302! Language=fr

besides only working on Safari for now, makes the user unable to access another language for the homepage, which is embarrassing (we may want to check the original version of a page). Any solution to that please?

hi victor,

can i ask if you have other redirects for other languages in your file as well?

hi @perry, yes I had redirects for DE and ES. But I removed all language redirects for now, because I don’t want the users to not be able to choose their translation on the homepage, until I find a way to make a “soft” redirect.

Here is the _redirect file history.

Hey @Victor,

It’s been covered a few times before. I think the best thing to do is create some language flags and allow the user to change this again!

Hi @Pie (copy @perry),

I don’t think I am well understood. I read many threads here on the subject but cannot find a solution.

You can test my homepage preview.algosphere.org with Safari: with a french language browser the user is redirected to preview.algosphere.org/fr according to my _redirect file. But then when he clicks on the language switcher button (in the top right corner), he cannot access the english version of the homepage (preview.algosphere.org), he keeps being redirected to the french version (preview.algosphere.org/fr).

Is this an expected behaviour? Shouldn’t the user be able to switch to whatever language he wants after the “first” redirect? It’s a problem to me if he cannot select a language because of the redirect.

Hey @Victor,

How about a subsequent rule to ‘reset’ the language forcing?

/fr / 302! Language=en

/fr / 302! Language=en

But that would not allow people with an FR browser to view the EN version of the website, nor people with an EN browser to view the FR version of the website, would it?

The goal is to redirect when they first go to the homepage, but then let them choose what language they want to see in the end.

I could get this behavior with the nf_lang cookie maybe.

Whoops, you’re absolutely right. Rookie mistake!

This could be because you reference ../ in your href, rather than / on its own. Although they’re both accurate syntax, I’d be interested to see if changing this changes the behaviour of the redirects/browser.

Maybe a rule such as /fr?t / 302! Language=en would work and you can have the toggle point to the new path. Again, just another idea.

Lastly, your suggestion is a great one; either nf_lang or nf_country may be able to help here!

Indeed I managed to make it work with a cookie, see it in action here: https://algosphere.org/.

The redirect is working (not only in Safari!) and is based on the last language selected via the language switcher.

I’m now waiting for the _redirect method to work not only on Safari, so the user can be redirected on the first visit (which the cookie method doesn’t allow).