]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/web/server/lilypond.org.htaccess
issue 4813: replace urchin.js with analytics.js and fix redundant hostnames
[lilypond.git] / Documentation / web / server / lilypond.org.htaccess
1 # htaccess for root dir of lilypond.org
2 # ----------------------------------------------------
3 #   The file comes from git master:
4 #   Documentation/web/server/lilypond.org.htaccess
5 #
6 #   Please do not edit it directly (unless something
7 #   is critically broken); instead, change it in git
8 #   and then do the:
9 #     update-git.sh
10 #     check-git.sh
11 #     copy-git.sh
12 #     make-website.sh
13 #  as discussed in:
14 #    Contributor 5.2 Uploading and security
15 # ----------------------------------------------------
16
17 RewriteEngine On
18
19 # Permanent redirect from www.lilypond.org to lilypond.org
20 RewriteCond "%{HTTP_HOST}" "^www\.(.+)$" [NC]
21 RewriteRule "^/?(.*)$"     "http://%1/$1" [R=301,L,NE]
22
23 # Deny following of symlinks by robots.
24 # HTTrack is a known offender.
25 # better yet, to redirect this to page that tells adminstrator
26 # about brokenness
27 RewriteCond %{HTTP_USER_AGENT} httrack [NC]
28 RewriteRule ^.*/source/.*$ /please-respect-robots.txt.html [L]
29
30 # Deny rogue crawler
31 RewriteCond %{HTTP_USER_AGENT} ^(.*)AhrefsBot(.*) [NC]
32 RewriteRule .* - [F,L]
33
34 # Permanent top level entry points -- ./doc
35 RedirectMatch ^/music-glossary /glossary
36 RedirectMatch ^/tutorial /learning
37 RedirectMatch ^/documentation/$ /doc
38 # Possibly resurrect this with new web site
39 # This breaks the documentation index with old site
40 # RedirectMatch ^/documentation$ /doc
41 #
42 RedirectMatch ^/bugs    /bug-reports
43 #RedirectMatch ^/bugs   http://code.google.com/p/lilypond/issues/list
44 # the new website already has an /authors
45 #RedirectMatch ^/authors /doc/Documentation/topdocs/AUTHORS
46 # the new website has news on the main page
47 RedirectMatch ^/news    /
48 RedirectMatch ^/stable    /doc/stable
49 # the new website has a dedicated page for development.
50 #RedirectMatch ^/development    /doc/development
51
52 #old# default doc dir
53 RedirectMatch ^/doc/*$ /doc/v2.18
54 # make attempt at `latest' symlink avoid ^v catch-all doc fix rule below
55 RedirectMatch ^/doc//*latest/*(.*)$ /doc/v2.19/$1
56 RedirectMatch ^/doc//*development/*(.*)$ /doc/v2.19/$1
57 RedirectMatch ^/doc//*stable/*(.*)$ /doc/v2.18/$1
58 RedirectMatch ^/doc//*([^v].*)$ /doc/v2.18/$1
59 RedirectMatch ^(/Documentation.*)$ /doc/v2.18$1
60 RedirectMatch ^/index$ /
61
62 # fix root calculation: no double slashes
63 # RedirectMatch ^(.*/)/+(.*)$ $1$2
64
65 ###########################################
66
67 ## Rewrite all non-existing files at toplevel to the /website/ dir, so our
68 ## internal structure for rsync doesn't have to be changed.
69 ## This works for the current/old site as well as the new one.
70
71 RewriteEngine on
72 RewriteBase /
73
74 SetEnvIf REQUEST_URI .* WEB=/website
75
76 # Rewrite empty to /website
77 RewriteCond %{REQUEST_URI} ^/*$
78 RewriteRule ^(/*)$ %{ENV:WEB}/ [QSA,L]
79
80 # css Request without directory part
81 RewriteCond %{REQUEST_URI} ^/?[^/]+[.]css$
82 # ...that does not match match an existing file
83 RewriteCond %{REQUEST_FILENAME} !-f
84 # ...and does not match an existing directory
85 RewriteCond %{REQUEST_FILENAME} !-d
86 # ...prefix with website
87 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
88
89 # Request without trailing slash
90 RewriteCond %{REQUEST_URI} !.*/$
91 # ...that would access a directory in /website
92 RewriteCond %{DOCUMENT_ROOT}%{ENV:WEB}%{REQUEST_URI} -d
93 # ...and does not start with /web
94 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
95 RewriteCond %{REQUEST_URI} !^/website
96 # ...and does not start with /doc$
97 RewriteCond %{REQUEST_URI} !^/doc$
98 # ...add trailing slash for [menu] and to avoid /web/ in browser url
99 RewriteRule ^(.+)$ http://%{HTTP_HOST}/$1/ [R,QSA,L]
100
101 # Request that does not start with /website
102 RewriteCond %{REQUEST_URI} !^/website
103 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
104 # ...and does not start with /doc/
105 RewriteCond %{REQUEST_URI} !^/doc/
106 # ...and is not /doc$
107 RewriteCond %{REQUEST_URI} !^/doc$
108 # ...and does not match match an existing file
109 RewriteCond %{REQUEST_FILENAME} !-f
110 # ...and does not match an existing directory
111 RewriteCond %{REQUEST_FILENAME} !-d
112 # ..prefix with /web
113 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
114
115 ## Redirect the old web/ to the homepage
116 RedirectMatch 301 ^/web/.* /
117
118 ###########################################
119
120 # latin1 version copied to web and doc/2.x
121 AddDefaultCharset utf-8
122 AddCharset utf-8 .html
123 AddCharset utf-8 .de
124 AddCharset utf-8 .en
125 AddCharset utf-8 .es
126 AddCharset utf-8 .fr
127 AddCharset utf-8 .nl
128 AddCharset utf-8 .txt
129
130 # fix broken auto language selection for Hungarian
131 AddLanguage hu .hu
132
133
134
135 # FIXME: separate this from the main "root" .htaccess material
136 DirectoryIndex index
137