internationalization - How to make i18n support filenames in Drupal 7? -
so have standard file located at:
/sites/default/files/hello.png
i can access so:
http://www.example.com/sites/default/files/hello.png
however, i18n, nice if prefixed paths work these files. example, link doesn't work:
http://www.example.com/us/sites/default/files/hello.png
but doesn't.
so question is, how can make these "country-specific" paths work files?
i thinking might need in htaccess , create module filters , redirects these paths, sounds way effort , perhaps missing easy way enable this?
you can use htaccess make language-version urls redirect default url files/images. if won't need further in drupal code (e.g. custom module).
your rewrite rule this
rewriteengine on rewriterule ^([a-za-z-]*)/sites/default/files/(.*)$ sites/default/files/$2 [r=301,l]
updated
if site in subdirectory e.g. 'drupal', modify rewrite rule this
rewriterule ^drupal/([a-za-z-]*)/sites/default/files/(.*)$ drupal/sites/default/files/$2 [r=301,l]
Comments
Post a Comment