]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/web/server/lilypond.org.htaccess
Merge remote-tracking branch 'origin/translation'
[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 RedirectMatch ^/wiki    http://wiki.lilynet.net
41 # the new website already has an /authors
42 #RedirectMatch ^/authors /doc/Documentation/topdocs/AUTHORS
43 # the new website has news on the main page
44 RedirectMatch ^/news    /
45 RedirectMatch ^/stable    /doc/stable
46 # the new website has a dedicated page for development.
47 #RedirectMatch ^/development    /doc/development
48
49 #old# default doc dir
50 RedirectMatch ^/doc/*$ /doc/v2.18
51 # make attempt at `latest' symlink avoid ^v catch-all doc fix rule below
52 RedirectMatch ^/doc//*latest/*(.*)$ /doc/v2.19/$1
53 RedirectMatch ^/doc//*development/*(.*)$ /doc/v2.19/$1
54 RedirectMatch ^/doc//*stable/*(.*)$ /doc/v2.18/$1
55 RedirectMatch ^/doc//*([^v].*)$ /doc/v2.18/$1
56 RedirectMatch ^(/Documentation.*)$ /doc/v2.18$1
57 RedirectMatch ^/index$ /
58
59 # fix root calculation: no double slashes
60 # RedirectMatch ^(.*/)/+(.*)$ $1$2
61
62 ###########################################
63
64 ## Rewrite all non-existing files at toplevel to the /website/ dir, so our
65 ## internal structure for rsync doesn't have to be changed.
66 ## This works for the current/old site as well as the new one.
67
68 RewriteEngine on
69 RewriteBase /
70
71 SetEnvIf REQUEST_URI .* WEB=/website
72
73 # Rewrite empty to /website
74 RewriteCond %{REQUEST_URI} ^/*$
75 RewriteRule ^(/*)$ %{ENV:WEB}/ [QSA,L]
76
77 # css Request without directory part
78 RewriteCond %{REQUEST_URI} ^/?[^/]+[.]css$
79 # ...that does not match match an existing file
80 RewriteCond %{REQUEST_FILENAME} !-f
81 # ...and does not match an existing directory
82 RewriteCond %{REQUEST_FILENAME} !-d
83 # ...prefix with website
84 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
85
86 # Request without trailing slash
87 RewriteCond %{REQUEST_URI} !.*/$
88 # ...that would access a directory in /website
89 RewriteCond %{DOCUMENT_ROOT}%{ENV:WEB}%{REQUEST_URI} -d
90 # ...and does not start with /web
91 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
92 RewriteCond %{REQUEST_URI} !^/website
93 # ...and does not start with /doc$
94 RewriteCond %{REQUEST_URI} !^/doc$
95 # ...add trailing slash for [menu] and to avoid /web/ in browser url
96 RewriteRule ^(.+)$ http://%{HTTP_HOST}/$1/ [R,QSA,L]
97
98 # Request that does not start with /website
99 RewriteCond %{REQUEST_URI} !^/website
100 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
101 # ...and does not start with /doc/
102 RewriteCond %{REQUEST_URI} !^/doc/
103 # ...and is not /doc$
104 RewriteCond %{REQUEST_URI} !^/doc$
105 # ...and does not match match an existing file
106 RewriteCond %{REQUEST_FILENAME} !-f
107 # ...and does not match an existing directory
108 RewriteCond %{REQUEST_FILENAME} !-d
109 # ..prefix with /web
110 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
111
112 ## Redirect the old web/ to the homepage
113 RedirectMatch 301 ^/web/.* /
114
115 ###########################################
116
117 # latin1 version copied to web and doc/2.x
118 AddDefaultCharset utf-8
119 AddCharset utf-8 .html
120 AddCharset utf-8 .de
121 AddCharset utf-8 .en
122 AddCharset utf-8 .es
123 AddCharset utf-8 .fr
124 AddCharset utf-8 .nl
125 AddCharset utf-8 .txt
126
127 # fix broken auto language selection for Hungarian
128 AddLanguage hu .hu
129
130
131
132 # FIXME: separate this from the main "root" .htaccess material
133 DirectoryIndex index
134