Hi everyone,
I am kind of experimenting right now and am currently trying to set up a mulilingual (single region) website. I definitly need some help with my settings here...
Let's assume example.com is my website in English. Now I want to split it up in French and English, with the location France. (I just add the location in case I will add more locations later that year.) Want I want to achieve:
en-fr.example.com = English version of french website
fr-fr.example.com = French version of french website
Requests to example.com should be checked for language preferences and their location. If the request comes from France, and/or the language preferences are French I want the request to be redirected to fr-fr.example.com. All other requests shall be redirected to the english website en-fr.example.com.
I know I can probe for browser languages (French and Breton in this case) and redirect like that
RewriteEngine on
RewriteCond %{HTTP:Accept-Language} (br|fr) [NC]
RewriteRule .* fr-fr.example.com [L]
- How would a redirect based on country IP ranges look like (I assume similar to a country IP range block) and
- How should I begin to mix this with my other settings (rewrites) so far?
This is what I used to develop the french version:
Options +FollowSymLinks +Multiviews
RewriteEngine on
RewriteBase /
AddCharset UTF-8 .html
# enforce trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^!/$ http://fr-fr.example.com/$1/ [R=301,L]
# index.html rewrite
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html$ http://fr-fr.example.com/$1 [R=301,L]
# extensionless url's
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.html?[^\ ]*\ HTTP/ [NC]
RewriteRule ^(([^/]+/)*[^.]+)\.html$ http://fr-fr.example.com/$1? [NC,R=301,L]
I assume you agree that this is a nice mess I'm trying to cleanup. I am a beginner in this topic and am in hope for some help / guidance here. Thanks in advance for your help!