Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 2.28 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. .htaccess rewrite for language subdomains
  2. <IfModule mod_rewrite.c>
  3.     RewriteEngine On
  4.     RewriteBase /
  5.     RewriteRule ^es.domain.com/?$   ^domain.com/es_ES?$ [L,R=301]  
  6. </IfModule>
  7.        
  8. Options +FollowSymlinks
  9. RewriteEngine On
  10. RewriteBase /
  11.  
  12. RewriteCond %{HTTP_HOST} ^es.
  13. RewriteCond %{REQUEST_URI} !^/es
  14. RewriteRule ^(.*)$   http://domain.com/es_ES/$1 [P,L]
  15.        
  16. RewriteCond %{HTTP_HOST} ^es.mydomain.com$
  17. # Change the path:
  18. RewriteRule ^/?$ /public/www/index.php
  19.        
  20. RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
  21. # Create an environment variable to remember the language:
  22. RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
  23.  
  24. # Now check if the LANGUAGE is empty (= doesn't) exists
  25. RewriteCond %{ENV:LANGUAGE} ^$
  26. # If so, create the default language (=es):
  27. RewriteRule (.*) - [QSA,E=LANGUAGE:es]
  28.        
  29. RewriteCond %{ENV:LANGUAGE} ^es$
  30. # Change the root folder:
  31. RewriteRule ^/?$ /public/www/index.php
  32.        
  33. RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
  34. # Create an environment variable to remember the language:
  35. RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
  36. # Now check if the LANGUAGE is empty (= doesn't exist)
  37. RewriteCond %{ENV:LANGUAGE} ^$
  38. # If so, create the default language (=es):
  39. RewriteRule (.*) - [QSA,E=LANGUAGE:es]
  40. # Change the root folder of the spanish language:
  41. RewriteCond %{ENV:LANGUAGE} ^es$
  42. # Change the root folder:
  43. RewriteRule ^/?$ /public/www/index.php
  44.        
  45. RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
  46. # Create an environment variable to remember the language:
  47. RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
  48. # Now check if the LANGUAGE is empty (= doesn't exist)
  49. RewriteCond %{ENV:LANGUAGE} ^$
  50. # If so, create the default language (=es):
  51. RewriteRule (.*) - [QSA,E=LANGUAGE:es]
  52.  
  53. # WHATEVER THE LANGUAGE ADD IT TO THE URI:
  54. RewriteRule (.*) $1?language=%{ENV:LANGUAGE} [QSA]
  55.        
  56. <IfModule mod_rewrite.c>
  57.     RewriteEngine On
  58.     RewriteBase /
  59.     RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
  60.     RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
  61.     RewriteCond %{ENV:LANGUAGE} ^$
  62.     RewriteRule (.*) - [QSA,E=LANGUAGE:es]
  63.     RewriteRule (.*) $1?language=%{ENV:LANGUAGE} [QSA]
  64. </IfModule>
  65.        
  66. RewriteCond %{HTTP_HOST} ^(us|fr|pt).mydomain.com$
  67. RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
  68. RewriteCond %{ENV:LANGUAGE} ^$
  69. RewriteRule (.*) - [QSA,E=LANGUAGE:es]
  70. RewriteCond %{ENV:LANGUAGE} ^es$
  71. RewriteRule ^/?$ /public/www/index.php