Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. ==== Rewrite rules
  2. # If we have a MS_LOCALE cookie
  3. # and the requested path isn't already infixed (multi{lingual,site} sites)
  4. # Add the MS_LOCALE cookie to the requested path to infix it
  5. RewriteCond %{HTTP_COOKIE} MS_LOCALE=(.*)[-,;]?
  6. RewriteCond %{REQUEST_FILENAME} ![a-z]{2}_[a-z]{2}\.
  7. RewriteRule ^(.*)\.(jpg|jpeg|png|gif)$ $1_%1.$2
  8.  
  9. # Strip off region if we can't find a file; example_fr.jpg
  10. RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  11. RewriteRule ^(.*)(_[a-z]{2})\.(jpg|jpeg|png|gif)$ $1.$3 [C]
  12.  
  13. # Strip off language if we can't find a file; example.jpg
  14. RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  15. RewriteRule ^(.*)(_[a-z]{2})\.(jpg|jpeg|png|gif)$ $1.$3
  16.  
  17.  
  18. ==== File system set up
  19. /media/dvd
  20. /docroot/media/images/testms/test_fr_fr.jpg
  21. /docroot/me -> /docroot/media/images (symlink)
  22.  
  23.  
  24. ==== Working request, note "prefixed with document_root" line
  25.  
  26. Request:
  27. cookie "MS_LOCALE=fr_fr"
  28. 'http://localhost:10046/me/testms/test.jpg'
  29.  
  30. Rewrite log:
  31. ...do above rules which identifies test_fr_fr.jpg file in the docroot
  32. local path result: /me/testms/test_fr_fr.jpg
  33. prefixed with document_root to /home/pmarkham/perlgem/sites/maccosmetics/fr/me/testms/test_fr_fr.jpg
  34. go-ahead with /home/pmarkham/perlgem/sites/maccosmetics/fr/me/testms/test_fr_fr.jpg [OK]
  35.  
  36.  
  37. ==== Not working request, note that path is not prefixed
  38.  
  39. Request:
  40. cookie "MS_LOCALE=fr_fr"
  41. 'http://localhost:10046/media/images/testms/test.jpg'
  42.  
  43. Rewrite log:
  44. ...do above rules which identifies test_fr_fr.jpg file in the docroot
  45. local path result: /media/images/testms/test_fr_fr.jpg
  46. go-ahead with /media/images/testms/test_fr_fr.jpg [OK]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement