httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Scoffier <ma...@metm.org>
Subject [users@httpd] still content negotiation problems
Date Mon, 13 Jun 2005 19:39:36 GMT
Hello,

I am stuck, I've read a lot of docs, and still it doesn't work.

I am trying to set up a site which will serve pages in french and
english.  I have read the pages at 
  http://httpd.apache.org/docs/content-negotiation.html
  http://httpd.apache.org/docs/mod/mod_mime.html#addlanguage
  http://httpd.apache.org/docs/mod/mod_negotiation.html
  http://ppewww.ph.gla.ac.uk/~flavell/www/lang-neg.html
  http://tranchant.plus.com/notes/multiviews

And the gmane.comp.apache.user archive of this list, and still my server
refuses to play nice, or the heat is making me stoopid...

What I have done so far (I was thinking of making a little toot cause
the documentation sure is lacking):

I'm using OpenBSD's apache (which does not have many "standard" modules
compiled):

  compiled mod_negotiation and mod_mime (which I am not 100% sure is needed):
    cd /usr/scr/usr.sbin/httpd/modules/standard
	apxs -i -a -c mod_negociation.c
	apxs -i -a -c mod_mime.c

apxs which I haven't used before puts the modules in
/usr/lib/apache/modules and adds the two LoadModule lines to
/var/www/conf/httpd.conf cool.

LoadModule negotiation_module /usr/lib/apache/modules/mod_negotiation.so
LoadModule mime_module        /usr/lib/apache/modules/mod_mime.so

(are there other modules I need ?)

    apachectl configtest 
    Syntax OK 

Haven't broken anything good.  Now for httpd.conf :

I want to keep much of the old site working.  If there was an index.html
version and there is no french version I would like index.html sent to
the browser.  If there is a index.html.fr I would like the negotiating
to happen sending the correct page depending Accept-Language header sent
out by the browser.  Seems that I have to then change the english
index.html to index.html.html and the french to index.html.fr
As per: http://ppewww.ph.gla.ac.uk/~flavell/www/lang-neg.html

<VirtualHost *>
        ServerName langnego.no-ip.org
        DocumentRoot /var/www/htdocs/langnego
        ErrorLog /var/www/logs/langnego.no-ip.org/error.log
        CustomLog /var/www/logs/langnego.no-ip.org/access.log "%h %l %u %t \"%r\" %s %b \"
%{User-agent}i\" \"%{Accept-language}i\""
</VirtualHost>

<Directory /var/www/htdocs/langnego/ >
        Options +MultiViews
        AddLanguage fr .fr
        AddLanguage en .en
        LanguagePriority fr en
        DirectoryIndex index
</Directory>

Here's my directory structure (you can test at http://langnego.no-ip.org ):

$ ls /var/www/htdocs/langnego/
index.html.fr     index.html.html   test.html.fr      test.html.html

I set my browser to prefer fr which I can tell from the custom log (see below)
the default directory returns the english page.  A request for test.html
returns a 404, and just when you thought +MultiViews wasn't working a request
for test returns the english text.html.html .  When I go to Google.com I get
their french page correctly...
 

64.81.200.243 - - [13/Jun/2005:15:44:30 -0400] "GET / HTTP/1.1" 200 17 "Mozilla/5.0 (X11;
U; Linux i686; en-US; rv:1.7.8) Gecko/20050514 Firefox/1.0.4" "fr,en;q=0.5"
64.81.200.243 - - [13/Jun/2005:15:44:38 -0400] "GET /test.html HTTP/1.1" 404 215 "Mozilla/5.0
(X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050514 Firefox/1.0.4" "fr,en;q=0.5"
64.81.200.243 - - [13/Jun/2005:15:48:07 -0400] "GET /test HTTP/1.1" 200 17 "Mozilla/5.0 (X11;
U; Linux i686; en-US; rv:1.7.8) Gecko/20050514 Firefox/1.0.4" "fr,en;q=0.5"


Thanks for any tips,

-- 
Marco



---------------------------------------------------------------------
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


Mime
View raw message