[Bins] Language issue
Jérôme SAUTRET
jerome at sautret.org
Mon Jun 20 01:38:18 BST 2005
On Sun, Jun 19, 2005 at 07:28:28PM -0400, Satya wrote:
> On Mon, Jun 20, 2005 at 12:08:34AM +0200, Bettina Slottved wrote:
> >I have about 2500 pictures on my daughters' websites. At present, their
> >sites are in Danish but we have a lot of American friends who don't
> >speak Danish, so I would like to make an English site as well but I
> >think that it is stupid to have all the pictures published twice.
>
> Depends on how your web server etc. is set up.
>
> One way: make two separate sites, then delete all the images from one.
> Have the html files suffixed with the language code:
> index.html.en or index.html.[whatever it is for danish]
> and then merge the two trees. This would need some simple but deep bash
> or perl scripting.
>
> Or keep the trees apart, and any requests for a JPG file in the tree
> that does not have pictures, rewrite (using Apache rules) to refer to
> the other tree. This needs knowledge of Apache configuration.
Yes, this should work with the mod_rewrite Apache module :
Say you have four albums trees corresponding to the same album in
different languages, in four different directories named with the
language code :
/var/www/album/da/...
/var/www/album/de/...
/var/www/album/en/...
/var/www/album/fr/...
To have only one copy of each picture, remove them from all trees
except one (say en) :
find /var/www/album/{da,de,fr} \( -iname \*.JPG -o -iname \*.jpg -o \
-iname \*.gif -o -iname \*.png -o -iname \*.avi -o -iname \*.mpg \)
\
-exec rm -f {} \;
And add a RewriteRule to your apache conf file to redirect all request
for an image to the en tree :
RewriteEngine on
RewriteRule ^/album/[^e][^n]/(.*\.(jpg|gif|png|avi|mpg))$ \
/album/en/$1 [NC]
--
Jérôme SAUTRET (Jerome @ SAUTRET.org) http://SAUTRET.org
Key 0x95D463F3 fingerprint 3B69 3B60 4D32 B8DF 2BF3 8035 5036 D41A 95D4 63F3
More information about the Bins
mailing list