summaryrefslogtreecommitdiff
path: root/webserver/multiviews.txt
blob: a8e281ae66674758fd33f5344f0667a22b5f6a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Date: Wed, 22 Oct 2014 15:39:34 -0400
From: Assaf Gordon <assafgordon@gmail.com>
Subject: "MultiViews" settings on www.gnu.org (language choice)

Hi guys,

I'm writing regarding my struggle with the www.gnu.org "mutliview" option
(which never selects "English" as default) on my mock-up server.

This is not urgent or critical - but of the slim chance that this might ring
any bells, I'd love to hear from you.

What I've found so far (simplified scenario):

1. The server has the following files:
    /var/www/home.html
    /var/www/home.ca.html
    /var/www/home.de.html
    /var/www/home.fr.html
    /var/www/home.ru.html

2. The user requests "http://server/home.html"

3. The various "rewrite rules" do their magic, and the last two rules in the
"/etc/apache2/sites-available/www.gnu.org-common" are:

   # Redirect foo.html to foo.
   # After this redirection, MultiViews should take over.
   RewriteCond %{REQUEST_FILENAME} !(\...(-..)?\.html)$
   RewriteRule ^(.*)\.html$ $1

   # Prevent Apache from interpreting the result
   # as a local filesystem path, e.g., "/home".
   RewriteRule ^(/.*)$ %{DOCUMENT_ROOT}$1

And so, "/home.html" is first chopped to "/home",
then prefixed with "/var/www/home" .

4. I see in the RewriteLog the last record is indeed "/var/www/home",
marked with "[OK]", then the log ends.

5. Now, the problem:
Given "/var/www/home", my Apache setup does not consider "home.html" as an
valid option for English.
It only considers files with language codes, and "home.ca.html" comes first.

If I add a symlink from "home.html" to "home.en.html" - it works fine.

=====

I was able to reproduce this behaviour on a 'clean' apache configuration with
"MultiView" setup - so this is likely the default Apache behavour, not an
artifact of the complicated 'multiview' configuration of gnu.org.

So I'm thinking of couple of options:
1. There are more Apache configurations settings that I'm missing (because
they did not appear in the published files).
Perhaps some tweak in "/etc/apache2/mods-available/mime.conf",
or some other file.

2. Perhaps there's a script to automatically create ".en.html" symlinks ?
sounds far-fetched. but could be.

3. Another option completely.

Since I do not have access to "gnu.org", I can only guess....

For now, I'm going to implement hack #2 .
=====