1 # htaccess for root dir of lilypond.org
5 # Deny following of symlinks by robots.
6 # HTTrack is a known offender.
7 # better yet, to redirect this to page that tells adminstrator
9 RewriteCond %{HTTP_USER_AGENT} httrack [NC]
10 RewriteRule ^.*/source/.*$ /please-respect-robots.txt.html [L]
12 # Permanent top level entry points -- ./doc
13 RedirectMatch ^/music-glossary /doc/Documentation/user/music-glossary/index
14 RedirectMatch ^/tutorial /doc/Documentation/user/lilypond-learning/Tutorial
15 RedirectMatch ^/documentation/$ /doc
16 # Possibly resurrect this with new web site
17 # This breaks the documentation index with old site
18 # RedirectMatch ^/documentation$ /doc
19 RedirectMatch ^/bugs http://code.google.com/p/lilypond/issues/list
20 RedirectMatch ^/wiki http://wiki.lilynet.net
21 RedirectMatch ^/authors /doc/Documentation/topdocs/AUTHORS
22 RedirectMatch ^/news /doc/Documentation/topdocs/NEWS
23 RedirectMatch ^/stable /doc/stable
24 RedirectMatch ^/development /doc/development
27 RedirectMatch ^/doc/*$ /doc/v2.12
28 # make attempt at `latest' symlink avoid ^v catch-all doc fix rule below
29 RedirectMatch ^/doc//*latest/*(.*)$ /doc/v2.13/$1
30 RedirectMatch ^/doc//*development/*(.*)$ /doc/v2.13/$1
31 RedirectMatch ^/doc//*stable/*(.*)$ /doc/v2.12/$1
32 RedirectMatch ^/doc//*([^v].*)$ /doc/v2.12/$1
33 RedirectMatch ^(/Documentation.*)$ /doc/v2.12$1
34 RedirectMatch ^/index$ /
36 # fix root calculation: no double slashes
37 # RedirectMatch ^(.*/)/+(.*)$ $1$2
39 ###########################################
41 ## Rewrite all non-existing files at toplevel to the /web/ dir, so our
42 ## internal structure for rsync doesn't have to be changed.
43 ## This works for the current/old site as well as the new one.
48 SetEnvIf REQUEST_URI .* WEB=/web
49 ## To switch over to the new site, we do not even need to put it in /web
51 # SetEnvIf REQUEST_URI .* WEB=/doc/v2.13/Documentation
53 # Rewrite empty to /web
54 RewriteCond %{REQUEST_URI} ^/*$
55 RewriteRule ^(/*)$ %{ENV:WEB}/ [QSA,L]
57 # css Request without directory part
58 RewriteCond %{REQUEST_URI} ^/?[^/]+[.]css$
59 # ...that does not match match an existing file
60 RewriteCond %{REQUEST_FILENAME} !-f
61 # ...and does not match an existing directory
62 RewriteCond %{REQUEST_FILENAME} !-d
64 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
66 # Request without trailing slash
67 RewriteCond %{REQUEST_URI} !.*/$
68 # ...that would access a directory in /web
69 RewriteCond %{DOCUMENT_ROOT}%{ENV:WEB}%{REQUEST_URI} -d
70 # ...and does not start with /web
71 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
72 RewriteCond %{REQUEST_URI} !^/web
73 # ...and does not start with /doc$
74 RewriteCond %{REQUEST_URI} !^/doc$
75 # ...add trailing slash for [menu] and to avoid /web/ in browser url
76 RewriteRule ^(.+)$ http://%{HTTP_HOST}/$1/ [R,QSA,L]
78 # Request that does not start with /web
79 RewriteCond %{REQUEST_URI} !^/web
80 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
81 # ...and does not start with /doc/
82 RewriteCond %{REQUEST_URI} !^/doc/
84 RewriteCond %{REQUEST_URI} !^/doc$
85 # ...and does not match match an existing file
86 RewriteCond %{REQUEST_FILENAME} !-f
87 # ...and does not match an existing directory
88 RewriteCond %{REQUEST_FILENAME} !-d
90 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
92 ###########################################
94 # latin1 version copied to web and doc/2.x
95 AddDefaultCharset utf-8
96 AddCharset utf-8 .html
102 AddCharset utf-8 .txt
104 # fix broken auto language selection for Hungarian
109 # FIXME: separate this from the main "root" .htaccess material