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