I know that Apache rewrite rules are not considered to be very newbie-friendly, but for some reason I keep struggling with them forever. This time I'm trying to do something that I know is rather simple but I can't get it to work and I just don't see it.
So far I have:
RewriteRule ^(.*)\.html$ index.php?page=$1 [nc]
which works fine and redirects www.domain.tld/xyz.html to www.domain.tld/index.html?page=xyz. So far, so good. But now I also would like to redirect something like www.domain.tld/en/xyz.html to www.domain.tld/index.html?lang=en&page=xyz (where 'en' obviously stands for 'English' and will change with the language to 'fr', 'nl' or what not).
Thing is, the language subdir in the URL must be optional and reverts to a default setting if omitted. So both www.domain.tld/xyz.html and www.domain.tld/language/xyz.html should be rewritten correctly (to index.php?etcetera with and without the l=language bit in the query string, respectively).
And I can't figure out how to make it work - I know I'm overlooking something stupidly simple, but I just don't see it.
Any suggestions to point me into the right direction would be appreciated!!