Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ==== Rewrite rules
- # If we have a MS_LOCALE cookie
- # and the requested path isn't already infixed (multi{lingual,site} sites)
- # Add the MS_LOCALE cookie to the requested path to infix it
- RewriteCond %{HTTP_COOKIE} MS_LOCALE=(.*)[-,;]?
- RewriteCond %{REQUEST_FILENAME} ![a-z]{2}_[a-z]{2}\.
- RewriteRule ^(.*)\.(jpg|jpeg|png|gif)$ $1_%1.$2
- # Strip off region if we can't find a file; example_fr.jpg
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
- RewriteRule ^(.*)(_[a-z]{2})\.(jpg|jpeg|png|gif)$ $1.$3 [C]
- # Strip off language if we can't find a file; example.jpg
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
- RewriteRule ^(.*)(_[a-z]{2})\.(jpg|jpeg|png|gif)$ $1.$3
- ==== File system set up
- /media/dvd
- /docroot/media/images/testms/test_fr_fr.jpg
- /docroot/me -> /docroot/media/images (symlink)
- ==== Working request, note "prefixed with document_root" line
- Request:
- cookie "MS_LOCALE=fr_fr"
- 'http://localhost:10046/me/testms/test.jpg'
- Rewrite log:
- ...do above rules which identifies test_fr_fr.jpg file in the docroot
- local path result: /me/testms/test_fr_fr.jpg
- prefixed with document_root to /home/pmarkham/perlgem/sites/maccosmetics/fr/me/testms/test_fr_fr.jpg
- go-ahead with /home/pmarkham/perlgem/sites/maccosmetics/fr/me/testms/test_fr_fr.jpg [OK]
- ==== Not working request, note that path is not prefixed
- Request:
- cookie "MS_LOCALE=fr_fr"
- 'http://localhost:10046/media/images/testms/test.jpg'
- Rewrite log:
- ...do above rules which identifies test_fr_fr.jpg file in the docroot
- local path result: /media/images/testms/test_fr_fr.jpg
- go-ahead with /media/images/testms/test_fr_fr.jpg [OK]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement