Can't Get Babel To Work Properly

I have been wracking my brain trying to get Babel to work with a English & French setup. I have followed the instructions I found in a few posts so my settings are:
Contexts
web
cultureKey: en
base_url: /
site_start: 1
site_url: {url_scheme}{http_host}{base_url}{cultureKey}/

fr
cultureKey: fr
base_url: /
site_start: 2
site_url: {url_scheme}{http_host}{base_url}{cultureKey}/

Access permissions for both contexts anonyous users are Load, List, and View

I then installed Babel and LangRouter.

My htaccess is:
RewriteEngine On
RewriteBase /

The Friendly URLs part
detect language when requesting the root (/)
RewriteCond %{HTTP:Accept-Language} !^en [NC]
RewriteRule ^$ en/ [R=301,L]
RewriteRule ^$ fr/ [R=301,L]

redirect all requests to /en/favicon.ico and /de/favicon.ico
to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr)/favicon.ico$ favicon.ico [L,QSA]

redirect all requests to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr)/assets(.*)$ assets$2 [L,QSA]

redirect all other requests to cultureKey
to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|fr)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

I created a resource in English and then a tranlated doc of that in French. My template is:

[[*pagetitle]]
[[*content]] [[BabelLinks?]]
So this setup doesn’t work and I am not sure why.

However, if I add the key to the base_url setting, ie:
web
base_url: /en/

fr
base_url: /fr/

then it works! But the url is not correct. It comes out as http://domain.com/en/en/ for web and http://domain.com/fr/fr/

Can anybody provide some insight on this?

Thanks in advance.

There are different ways to set up Babel.
The important thing is, that the .htaccess file matches what your router plugin expects.

If you are using LangRouter (as your router plugin), then I’m pretty sure you don’t have to set a cultureKey parameter in .htaccess.

RewriteRule ^(en|fr)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

Use the default RewriteRule instead (RewriteRule ^(.*)$ index.php?q=$1 [L,QSA])

And follow the steps in the LangRouter documentation.

Thanks @halftrainedharry !

Updating the .htaccess as you described and removing the /fr/ and /en/ from the base_url in the Context settings did the trick.

One more question, I am also installing Babel on another server but in a sub-folder. I tried replicating what I did in my other installation with the difference that in the .htaccess file, I changed:

RewriteBase /

to

RewriteBase /subfoldername/

but I get an error of too many redirects.

Had the same issue. When it comes to this setup in a subfolder I had to change the site_url to {url_scheme}{http_host}{base_url} and the corresponding base_url to the subfolder name followed by the corresponding culturekey e.g. /sub/en/.

Thanks @rotter I will give that a try.