]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/web/server/lilypond.org.htaccess
Release: update news.
[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 RedirectMatch ^/stable    /doc/stable
47 # the new website has a dedicated page for development.
48 #RedirectMatch ^/development    /doc/development
49
50 # Main doc URL redirects
51 RedirectMatch ^/doc/?$ /manuals
52 RedirectMatch ^/doc/stable/?$ /manuals
53 RedirectMatch ^/doc/development/?$ /development
54
55 # Allow to use deep links to latest stable or development docs
56 RedirectMatch ^/doc//*latest/*(.*)$ /doc/v2.19/$1
57 RedirectMatch ^/doc//*development/*(.*)$ /doc/v2.19/$1
58 RedirectMatch ^/doc//*stable/*(.*)$ /doc/v2.18/$1
59 RedirectMatch ^/doc//*([^v].*)$ /doc/v2.18/$1
60 RedirectMatch ^(/Documentation.*)$ /doc/v2.18$1
61 RedirectMatch ^/index$ /
62
63 # fix root calculation: no double slashes
64 # RedirectMatch ^(.*/)/+(.*)$ $1$2
65
66 ###########################################
67
68 ## Rewrite all non-existing files at toplevel to the /website/ dir, so our
69 ## internal structure for rsync doesn't have to be changed.
70 ## This works for the current/old site as well as the new one.
71
72 RewriteEngine on
73 RewriteBase /
74
75 SetEnvIf REQUEST_URI .* WEB=/website
76
77 # Rewrite empty to /website
78 RewriteCond %{REQUEST_URI} ^/*$
79 RewriteRule ^(/*)$ %{ENV:WEB}/ [QSA,L]
80
81 # css Request without directory part
82 RewriteCond %{REQUEST_URI} ^/?[^/]+[.]css$
83 # ...that does not match match an existing file
84 RewriteCond %{REQUEST_FILENAME} !-f
85 # ...and does not match an existing directory
86 RewriteCond %{REQUEST_FILENAME} !-d
87 # ...prefix with website
88 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
89
90 # Request without trailing slash
91 RewriteCond %{REQUEST_URI} !.*/$
92 # ...that would access a directory in /website
93 RewriteCond %{DOCUMENT_ROOT}%{ENV:WEB}%{REQUEST_URI} -d
94 # ...and does not start with /web
95 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
96 RewriteCond %{REQUEST_URI} !^/website
97 # ...and does not start with /doc$
98 RewriteCond %{REQUEST_URI} !^/doc$
99 # ...add trailing slash for [menu] and to avoid /web/ in browser url
100 RewriteRule ^(.+)$ http://%{HTTP_HOST}/$1/ [R,QSA,L]
101
102 # Request that does not start with /website
103 RewriteCond %{REQUEST_URI} !^/website
104 RewriteCond %{REQUEST_URI} !^%{ENV:WEB}
105 # ...and does not start with /doc/
106 RewriteCond %{REQUEST_URI} !^/doc/
107 # ...and is not /doc$
108 RewriteCond %{REQUEST_URI} !^/doc$
109 # ...and does not match match an existing file
110 RewriteCond %{REQUEST_FILENAME} !-f
111 # ...and does not match an existing directory
112 RewriteCond %{REQUEST_FILENAME} !-d
113 # ..prefix with /web
114 RewriteRule ^(.+)$ %{ENV:WEB}/$1 [QSA,L]
115
116 ## Redirect the old web/ to the homepage
117 RedirectMatch 301 ^/web/.* /
118
119 ###########################################
120
121 # latin1 version copied to web and doc/2.x
122 AddDefaultCharset utf-8
123 AddCharset utf-8 .html
124 AddCharset utf-8 .de
125 AddCharset utf-8 .en
126 AddCharset utf-8 .es
127 AddCharset utf-8 .fr
128 AddCharset utf-8 .nl
129 AddCharset utf-8 .txt
130
131 # Add extensions for language negotiation
132 # See: https://www.w3.org/International/questions/qa-apache-lang-neg
133 AddLanguage ca .ca
134 AddLanguage cs .cs
135 AddLanguage de .de
136 AddLanguage es .es
137 AddLanguage fr .fr
138 AddLanguage hu .hu
139 AddLanguage it .it
140 AddLanguage ja .ja
141 AddLanguage nl .nl
142 AddLanguage zh .zh
143
144
145 # FIXME: separate this from the main "root" .htaccess material
146 DirectoryIndex index
147