I'd like to achieve two goals using rewrite conditions under apache2 but this is not actually my cup of tea:
redirect mydomain.com to www.mydomain.com and this is pretty easy to do. I use:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
redirect mydomain.es to www.mydomain.com/?lang=es (and so on for different languages)
How can I write the second statement? And how can I combine this rule with the first one?
Thank you in advance for your help!