Forum Moderators: phranque
I try to convert:
fr.domain.com
to
domain.com/lang/fr
I tried:
RewriteCond %{HTTP_HOST} ^fr\.example\.com$
RewriteRule ^(.*)$ $1/lang/fr [L]
But it doesn't work. Note that I also have another rewriting rule to point everything to my main controller:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}!\.(gif¦jpg¦jpeg¦png¦swf)$
RewriteRule ^(.*) index.php
I'm trying to make them working together.
Any help will be really appreciated!
[edited by: jdMorgan at 1:54 am (utc) on Oct. 13, 2007]
[edit reason] example.com [/edit]
You will also need to explicitly prevent recursion if this code is located in .htaccess:
RewriteCond %{HTTP_HOST} ^fr\.example\.com
RewriteCond $1 !lang/fr
RewriteRule (.*) $1/lang/fr
#
RewriteCond %{REQUEST_URI} !\.(gif¦jpe?g¦png¦swf)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php [L]
Note also that the pattern was modified to combine "jpg" and "jpeg" into the equivalent "jpe?g".
I made a few additional minor corrections/optimizations as well.
Replace all broken pipe "¦" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.
Jim