You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "William M. Shubert" <wm...@igoweb.org> on 2004/10/18 02:20:28 UTC
[users@httpd] Content negotiation to choose a directory tree?
Hi. I have a site that has been translated into a lot of languages (over
a dozen). To manage all the HTML files and make sure customers get to
the right place, I've got a subdirectory for each translation, and the
index.html in the root is actually a .var file that uses content
negotation to send you to the proper subdirectory; then the index.html
in each subdirectory specfies "<base
href="http://www.x.com/<language>/index.html">", so once the first .var
puts you where you belong everything proceeds normally. This works fine.
Now for my problem: Sometimes I need to publish a deep link in a place
where people of different languages may see it. I can't really publish
"http://www.x.com/english/deep/link.html", because then everybody will
see the English version. What I really want is to be able to tell
apache, "whenever you see http://www.x.com/default/*", change the
"default" to be whichever of these 12 languages the user supports best.
In other words, mix together mod_rewrite and content negotiation. Then I
could publish links with "default" for the language, and everybody will
see the page in their own language. The RewriteCond rules for
mod_rewrite don't give me access to the "Accept-Language" header (and
anyway using that would be painful due to the complicated syntax of
Accept-Language). Has anybody got a clever way to do this, or a module
that does it already? The only options I found are to mix all my files
together, using extensions to specify language (ugh! 12 files for each
language in each folder would be a nightmare to manage), or write up a
.var file for each deep link I publish (not very practical, at times I
will do this 10 times a day, based on the needs at the moment).
Thanks!
Bill Shubert (wms@igoweb.org)
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Content negotiation to choose a directory tree?
Posted by Viktor Soderqvist <vi...@knoeffnet.net>.
If I have got this right; your site consists of;
/
/english
/german
/dutch
etc etc etc
What I don't see is why you simply do not make (content) templates of
the pages, so that you have an index.php in /, and then just let's a
(for example) PHP script fetch the actual content of the page. Sounds
much easier to me than having a number of directories and files. Thus,
this, to me, seems more like a coding problem than an apache one.
But maybe this isn't a possibility. Anywho.
Regards
Viktor
William M. Shubert said the following on 2004-10-18 02:20:
> Hi. I have a site that has been translated into a lot of languages (over
> a dozen). To manage all the HTML files and make sure customers get to
> the right place, I've got a subdirectory for each translation, and the
> index.html in the root is actually a .var file that uses content
> negotation to send you to the proper subdirectory; then the index.html
> in each subdirectory specfies "<base
> href="http://www.x.com/<language>/index.html">", so once the first .var
> puts you where you belong everything proceeds normally. This works fine.
>
> Now for my problem: Sometimes I need to publish a deep link in a place
> where people of different languages may see it. I can't really publish
> "http://www.x.com/english/deep/link.html", because then everybody will
> see the English version. What I really want is to be able to tell
> apache, "whenever you see http://www.x.com/default/*", change the
> "default" to be whichever of these 12 languages the user supports best.
> In other words, mix together mod_rewrite and content negotiation. Then I
> could publish links with "default" for the language, and everybody will
> see the page in their own language. The RewriteCond rules for
> mod_rewrite don't give me access to the "Accept-Language" header (and
> anyway using that would be painful due to the complicated syntax of
> Accept-Language). Has anybody got a clever way to do this, or a module
> that does it already? The only options I found are to mix all my files
> together, using extensions to specify language (ugh! 12 files for each
> language in each folder would be a nightmare to manage), or write up a
> .var file for each deep link I publish (not very practical, at times I
> will do this 10 times a day, based on the needs at the moment).
>
> Thanks!
> Bill Shubert (wms@igoweb.org)
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Content negotiation to choose a directory tree?
Posted by Joshua Slive <js...@gmail.com>.
On Sun, 17 Oct 2004 17:20:28 -0700, William M. Shubert <wm...@igoweb.org> wrote:
> The RewriteCond rules for
> mod_rewrite don't give me access to the "Accept-Language" header
Not true. mod_rewrite can access arbitrary HTTP headers (ie
%{HTTP:ACCEPT-LANGUAGE})
> The only options I found are to mix all my files
> together, using extensions to specify language (ugh! 12 files for each
> language in each folder would be a nightmare to manage)
As opposed to 12 folders for each file... Seems like an equal nightmare to me.
You could also certainly do it with a CGI script (named "default" in
your document root), which could redirect appropriately.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org