I am trying to achieve more things:
- HTTP:// should redirect to HTTPS://
- www.example.com should redirect to www.example.com/en/ or /it/ depending on client language
- links should resolve to www.example.com?lang=en
- All urls different from index.php? (e.g. www.example.com/abcd) should all be redirected to index.php
I got working the 1.3.4 by using:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
# RewriteCond %{HTTP:Accept-Language} ^en [NC]
# RewriteRule ^$ https://www.example.com/en/ [L,R=301]
# RewriteCond %{HTTP:Accept-Language} ^it [NC]
# RewriteRule ^$ https://www.example.com/it/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(en|it)/(.*) $2?lang=$1 [QSA]
RewriteRule ^([^/]+)$ index.php?op=$1 [L,NS,QSA] index.php
Trying now to achieve point 2. If I remove the comments it ends up in a redirect loop + error
Is there any way?