Sigh... I tried constructing some rewrite rules based on the following Stack Overflow questions: Question 1 Question 2
My .htaccess currently looks like this:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(en|fr|es|de)/
RewriteRule ^(.*)$ /en/$1 [R,L]
RewriteRule ^(en|fr|es|de)/(.*)$ $2?locale=$1 [L]
and I've tried all sorts of variations (including the exact answers given in the questions).
As it stands my URL is redirecting to:
/en/?locale=en
When I look at the root with what looks like an infinite redirect loop in Firefox ('The page isn't redirecting properly').
As you've probably guessed I want it to rewrite to /en/ on the root and for it to look like that in the browser. But I want the real url to be /?locale=en. There is an index.php there on the root. Maybe I need another rule to take that into account?
I don't know, I'm really tired and exasperated and .htaccess has always been my downfall. Any insight appreciated.