Forum Moderators: phranque
#the line where I try to make sure it's "forced" to be en-US
RewriteCond %{QUERY_STRING} ^en-us/$ [NC]
RewriteRule ^(.+)?$ http://%{HTTP_HOST}/en-US/$1 [L,R=301]
RewriteCond %{REQUEST_URI} !^/?en-US [NC]
RewriteCond %{REQUEST_URI} !^/images
RewriteCond %{REQUEST_URI} !^/fonts
RewriteRule ^(.+)?$ http://%{HTTP_HOST}/en-US/$1 [L,R=301]
RewriteRule ^images(/([a-z0-9/._\-]*))?$ /en-US/templates/theme2010/images/$2 [NC,L]
RewriteRule ^fonts(/([a-z0-9/._\-]*))?$ /en-US/fonts/$2 [NC,L]
############################################################################################
# Force WWW (force www to all urls except for these specific sub-domains
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^support.*
RewriteCond %{HTTP_HOST} !^wiki.*
RewriteCond %{HTTP_HOST} !^projects.*
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/en-US/$1 [R=301,L]
[edited by: jdMorgan at 4:02 pm (utc) on Mar 2, 2010]
[edit reason] de-linked HTTP_HOST lines for readability [/edit]
#the line where I try to make sure it's "forced" to be en-US
RewriteRule ^en-us(/.*)?$ http://%{HTTP_HOST}/en-US/$1 [L,R=301]
#
RewriteCond $1 !^(en-US|images|fonts) [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/en-US/$1 [L,R=301]
#
RewriteRule ^(images|fonts)(/([a-z0-9/._\-]*))?$ /en-US/templates/theme2010/$1/$3 [NC,L]
#
# Force WWW [b]and HTTPS[/b] (force www [b]and HTTPS[/b] for
# all URL requests except for these specific sub-domains
RewriteCond %{HTTP_HOST} !^(www|support|wiki|projects)\. [NC]
RewriteRule ^(.*)$ htt[b]ps:[/b]//www.%{HTTP_HOST}/en-US/$1 [R=301,L]
[edited by: jdMorgan at 6:45 pm (utc) on Mar 3, 2010]
RewriteEngine On
IndexIgnore *
Options +FollowSymLinks -Multiviews -Indexes
############################################################################################
RewriteRule ^en-us(/.*)?$ http://%{HTTP_HOST}/en-US/$1 [L,R=301]
############################################################################################
RewriteCond $1 !^(en-US|images|fonts) [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/en-US/$1 [L,R=301]
############################################################################################
RewriteRule ^(images|fonts)(/([a-z0-9/._\-]*))?$ /en-US/templates/digitalfyre2010/$1/$3 [NC,L]
[edited by: jdMorgan at 5:00 pm (utc) on Mar 5, 2010]
[edit reason] Removed domain name in code comments [/edit]
IndexIgnore *
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
#
# Externally redirect to canonicalize casing and trailing slashes on /images subirectory
RewriteCond $1 !^images/$
RewriteRule ^(images/?)$ http://%{HTTP_HOST}/images/ [NC,R=301,L]
#
# Externally redirect to canonicalize casing and trailing slashes on /fonts subdirectory
RewriteCond $1 !fonts/$
RewriteRule ^(fonts/?)$ http://%{HTTP_HOST}/fonts/ [NC,R=301,L]
#
# Externally redirect to canonicalize casing on /en-US subdirectory requests
RewriteCond $1 !^en-US/
RewriteRule ^(en-us(/(.*))?)$ http://%{HTTP_HOST}/en-US/$3 [NC,R=301,L]
#
# Internally rewrite all requests except for /images and /fonts
# subdirectory requests to /en-US subdirectory (unless already done)
RewriteCond $1 !^(en-US|images|fonts)/ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/en-US/$1 [R=301,L]
#
# Internally rewrite /images and /fonts subdirectory
# requests to /en-US/templates/company-name/ subdirectory
RewriteRule ^((images|fonts)/[a-z0-9/._\-]*)?$ /en-US/templates/example/$1 [NC,L]