|
1 | 1 | <VirtualHost *:8080> |
2 | 2 | ServerName licenses.productionwww.creativecommons.uk0.bigv.io |
3 | | - #ServerName creativecommons.org |
4 | 3 | DocumentRoot /var/www/creativecommons.org/docroot |
5 | 4 |
|
6 | 5 | # CloudFlare doesn't like ranges - 20150804-rob. |
7 | 6 | Header set Accept-Ranges none |
8 | 7 |
|
9 | | - # We're (ultimately) proxied through varnish, so drop idle connections quickly |
10 | | - KeepAlive Off |
| 8 | + # We're (ultimately) proxied through varnish, so drop idle connections |
| 9 | + # quickly |
| 10 | + KeepAlive Off |
11 | 11 |
|
12 | 12 | # For munin |
13 | 13 | <IfModule mod_status.c> |
14 | | - <Location /server-status> |
15 | | - SetHandler server-status |
16 | | - Require local |
17 | | - </Location> |
| 14 | + <Location /server-status> |
| 15 | + SetHandler server-status |
| 16 | + Require local |
| 17 | + </Location> |
18 | 18 | </IfModule> |
19 | 19 |
|
20 | 20 | # Only allow connections from wwwlive |
|
36 | 36 |
|
37 | 37 | <Location /server-status> |
38 | 38 | SetHandler server-status |
39 | | - Order deny,allow |
40 | | - Deny from all |
41 | | - Allow from 127.0.0.1 |
| 39 | + Order deny,allow |
| 40 | + Deny from all |
| 41 | + Allow from 127.0.0.1 |
42 | 42 | </Location> |
43 | 43 |
|
44 | | -# ScriptAlias "/update-translations" "/var/www/cci18n-webhook/app/webhook.php" |
45 | | -# ScriptAlias "/update-legalcode" "/var/www/ccorg-webhook/app/webhook.php" |
| 44 | + #ScriptAlias "/update-translations" "/var/www/cci18n-webhook/app/webhook.php" |
| 45 | + #ScriptAlias "/update-legalcode" "/var/www/ccorg-webhook/app/webhook.php" |
46 | 46 |
|
47 | 47 | #---------- |
48 | 48 | # Main (general configs) |
|
76 | 76 | DirectoryIndex deed |
77 | 77 | DefaultType text/html |
78 | 78 | AddDefaultCharset utf-8 |
79 | | - Require all granted |
| 79 | + Require all granted |
80 | 80 | </Location> |
81 | | - |
| 81 | + |
82 | 82 | # Always serve up deeds as text/html, even when the country code |
83 | 83 | # extension makes Apache think it's something else, like .pl being |
84 | 84 | # a perl script instead of Poland, but not if it's a CSS file. |
|
95 | 95 | ### ------------------------- #### |
96 | 96 | ## BEGIN mod_rewrite section ## |
97 | 97 | ### ------------------------- #### |
98 | | - |
| 98 | + |
99 | 99 | RewriteEngine on |
100 | 100 |
|
101 | 101 | # LogLevel alert rewrite:trace1 |
|
105 | 105 | # sure to recomment them and restart Apache when done because the file will |
106 | 106 | # become immense in a hurry. |
107 | 107 | #---------- |
108 | | - |
| 108 | + |
109 | 109 | #RewriteLog /tmp/rewrite.log |
110 | 110 | #RewriteLogLevel 5 |
111 | | - |
| 111 | + |
112 | 112 | #---------- |
113 | 113 | # Config |
114 | 114 | #---------- |
115 | | - |
| 115 | + |
116 | 116 | RewriteMap uppercase int:toupper |
117 | | - |
| 117 | + |
118 | 118 | #---------- |
119 | 119 | # License engine and legalcode |
120 | 120 | #---------- |
|
124 | 124 | #<Location /ccengine-fcgi> |
125 | 125 | # DefaultType text/html |
126 | 126 | # AddDefaultCharset utf-8 |
127 | | - #Require local |
128 | | -# Require all granted |
| 127 | + #Require local |
| 128 | +# Require all granted |
129 | 129 | # </Location> |
130 | 130 |
|
131 | 131 | <Directory /var/www/creativecommons.org/python_env/bin> |
|
141 | 141 | <Location /cc.engine-cache> |
142 | 142 | DefaultType text/html |
143 | 143 | AddDefaultCharset utf-8 |
144 | | - #Require all granted |
| 144 | + #Require all granted |
145 | 145 | </Location> |
146 | 146 |
|
147 | 147 | <Directory /var/www/creativecommons.org/python_env/cache> |
148 | 148 | Require all granted |
149 | 149 | </Directory> |
150 | 150 |
|
151 | 151 | #RewriteRule "^/discover/gift-guide(.*)$" "/wp-content/themes/creativecommons.org/discover/gift-guide/$1" [PT] |
152 | | - #Alias /discover/gift-guide/ /var/www/cc-wp-theme/creativecommons.org/discover/gift-guide/ |
| 152 | + #Alias /discover/gift-guide/ /var/www/cc-wp-theme/creativecommons.org/discover/gift-guide/ |
153 | 153 | #Alias /discover/gift-guide /var/www/creativecommons.org/discover/gift-guide |
154 | 154 | <Directory /var/www/creativecommons.org/discover/gift-guide> |
155 | 155 | Options Indexes FollowSymLinks MultiViews |
156 | | - # AllowOverride All |
157 | | - # Order allow,deny |
158 | | - # Allow from all |
| 156 | + # AllowOverride All |
| 157 | + # Order allow,deny |
| 158 | + # Allow from all |
159 | 159 | # Require all granted |
160 | | - # Satisfy Any |
| 160 | + # Satisfy Any |
161 | 161 | </Directory> |
162 | 162 |
|
163 | 163 | <Directory /var/www/creativecommons.org/faq/> |
164 | 164 | Options Indexes FollowSymLinks MultiViews |
165 | | - # AllowOverride All |
166 | | - # Order allow,deny |
167 | | - # Allow from all |
| 165 | + # AllowOverride All |
| 166 | + # Order allow,deny |
| 167 | + # Allow from all |
168 | 168 | # Require all granted |
169 | | - # Satisfy Any |
| 169 | + # Satisfy Any |
170 | 170 | </Directory> |
171 | 171 |
|
| 172 | + |
| 173 | + # Temporary Korean translation redirects |
| 174 | + RewriteRule ^/licenses/by/4.0/legalcode.ko https://creativecommons.org/licenses/by/4.0/legalcode [L,R=307] |
| 175 | + RewriteRule ^/licenses/by-sa/4.0/legalcode.ko https://creativecommons.org/licenses/by-sa/4.0/legalcode [L,R=307] |
| 176 | + RewriteRule ^/licenses/by-nd/4.0/legalcode.ko https://creativecommons.org/licenses/by-nd/4.0/legalcode [L,R=307] |
| 177 | + RewriteRule ^/licenses/by-nc/4.0/legalcode.ko https://creativecommons.org/licenses/by-nc/4.0/legalcode [L,R=307] |
| 178 | + RewriteRule ^/licenses/by-nc-sa/4.0/legalcode.ko https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode [L,R=307] |
| 179 | + RewriteRule ^/licenses/by-nc-nd/4.0/legalcode.ko https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode [L,R=307] |
| 180 | + |
| 181 | + |
172 | 182 | # Redirect all /license to /choose before we go any deeper |
173 | 183 | RewriteRule ^/choose$ http://creativecommons.org/choose/ [L,R=301] |
174 | 184 | RewriteRule ^/license$ http://creativecommons.org/choose/ [L,R=301] |
|
182 | 192 |
|
183 | 193 | # Fixes this repercussions of this bug: |
184 | 194 | # http://code.creativecommons.org/issues/issue898 |
| 195 | + RewriteRule ^/licenses/cc0/1.0(.*)$ https://creativecommons.org/publicdomain/zero/1.0$1 [L,R=301] |
185 | 196 | RewriteRule ^/licenses/CC0/1.0(.*)$ https://creativecommons.org/publicdomain/zero/1.0$1 [L,R=301] |
186 | | - # And #694 |
| 197 | + # And #694 |
187 | 198 | RewriteRule ^/licenses/zero/1.0/(.*)$ https://creativecommons.org/publicdomain/zero/1.0/$1 [L,R=301] |
188 | | - |
| 199 | + |
189 | 200 | # Address https://github.com/creativecommons/creativecommons.org/issues/563 |
190 | 201 | RewriteRule ^/publicdomain/zero/1.0/deed.en/$ https://creativecommons.org/publicdomain/zero/1.0/deed.en [L,R=301] |
191 | | - |
| 202 | + |
192 | 203 | # Legalcode rewrites |
193 | | - # FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites |
| 204 | + # FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites |
194 | 205 | RewriteRule ^/legalcode http://creativecommons.org/ [L,R=301] |
195 | 206 | RewriteRule .*legalcode/$ http://creativecommons.org/ [L,R=301] |
196 | | - RewriteRule ^/licenses/(.*)sampling\+/1.0/(.*)/legalcode$ /legalcode/$1samplingplus_1.0_$2.html [L] |
| 207 | + RewriteRule ^/licenses/(.*)sampling\+/1.0/(.*)/legalcode$ /legalcode/$1samplingplus_1.0_$2.html [L] |
197 | 208 | RewriteRule ^/licenses/(.*)sampling\+/1.0/legalcode$ /legalcode/$1samplingplus_1.0.html [L] |
198 | 209 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L] |
199 | 210 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L] |
200 | 211 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode\.([A-Za-z-]+)$ /legalcode/$1_$2_$3_$4.html [L] |
201 | | - RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.([A-Za-z-]+)$ /legalcode/$1_$2_$3.html [L] |
202 | | - RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode$ /legalcode/$1_$2_$3.html [L] |
| 212 | + RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.([A-Za-z-]+)$ /legalcode/$1_$2_$3.html [L] |
| 213 | + RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode$ /legalcode/$1_$2_$3.html [L] |
203 | 214 | RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L] |
204 | 215 | RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L] |
205 | 216 | # Legalcodes can have extensions of the form .fr or .zh-Hant |
206 | | - RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z](-[A-Z][a-z][a-z][a-z])?)$ /legalcode/$1_$2_$3.html [L] |
| 217 | + RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z](-[A-Z][a-z][a-z][a-z])?)$ /legalcode/$1_$2_$3.html [L] |
207 | 218 |
|
208 | 219 | # License RDF rewrites |
209 | | - # FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites |
| 220 | + # FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites |
210 | 221 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/license_rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
211 | 222 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
212 | 223 | RewriteRule ^/licenses/index.rdf$ /rdf/index.rdf [L,T=application/rdf+xml] |
|
215 | 226 | RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/license_rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
216 | 227 | RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
217 | 228 | RewriteRule .*rdf/$ http://creativecommons.org/ [L,R=301] |
218 | | - |
| 229 | + |
219 | 230 | # See if deed is cached before sending to cc.engine |
220 | | - # FIXME: eval memcache as an alternative? |
| 231 | + # FIXME: eval memcache as an alternative? |
221 | 232 | RewriteCond %{REQUEST_URI} ^/licenses |
222 | 233 | RewriteCond /var/www/creativecommons.org//python_env/cache/%{REQUEST_FILENAME} -s |
223 | 234 | RewriteRule ^/licenses/(.*) /cc.engine-cache/licenses/$1 [L,PT] |
224 | 235 |
|
225 | | - # FIXME: do we really need rewrites for other licenses like GPL, etc? |
| 236 | + # FIXME: do we really need rewrites for other licenses like GPL, etc? |
226 | 237 | RewriteRule (.*)licence(.*) https://creativecommons.org$1license$2 [L,R=301] |
227 | 238 | RewriteRule ^/(license|choose|characteristic|publicdomain)$ http://creativecommons.org/$1/ [L,R=301] |
228 | 239 | RewriteRule ^/(license|choose|characteristic|publicdomain)/(.*) /ccengine-fcgi/$1/$2 [PT,L] |
|
396 | 407 |
|
397 | 408 | RewriteRule ^/government http://creativecommons.org/publicpolicy [L,R=301] |
398 | 409 |
|
399 | | - #---------- |
| 410 | + #---------- |
400 | 411 | # Redirects to CC.net |
401 | | - #---------- |
402 | | - # FIXME: a bunch of these have moved / don't exist anymore |
403 | | - |
| 412 | + #---------- |
| 413 | + # FIXME: a bunch of these have moved / don't exist anymore |
404 | 414 | RewriteRule ^/about/affiliates.*$ http://creativecommons.net/supporters [R=301,L] |
405 | 415 | RewriteRule ^/about/lessigletter.*$ http://creativecommons.net/letters [L,R=301] |
406 | 416 | RewriteRule ^/about/supporters$ http://creativecommons.net/supporters [L,R=301] |
|
414 | 424 | #---------- |
415 | 425 | # Miscellaneous |
416 | 426 | #---------- |
417 | | - |
418 | 427 | # Map backwardly named license types to their actual location |
419 | 428 | RewriteRule ^/licenses/by-nc-nd/1.0/(.*)$ http://creativecommons.org/licenses/by-nd-nc/1.0/$1 [L,R=301] |
420 | 429 | RewriteRule ^/licenses/by-nd-nc/2.0/(.*)$ http://creativecommons.org/licenses/by-nc-nd/2.0/$1 [L,R=301] |
421 | | - |
| 430 | + |
422 | 431 | # Map the namespace document and schema URLs |
423 | | - # FIXME: are symlinks cleaner? |
| 432 | + # FIXME: are symlinks cleaner? |
424 | 433 | RewriteRule ^/ns$ /rdf/ns.html [L] |
425 | 434 | RewriteRule ^/schema.rdf$ /rdf/schema.rdf [L] |
426 | 435 |
|
|
452 | 461 | #---------- |
453 | 462 | # WordPress rules here instead of .htaccess |
454 | 463 | #---------- |
455 | | - |
| 464 | + |
456 | 465 | # NOTE: sometimes Wordpress decides what page to display based on both the |
457 | 466 | # query string AND the REQUEST_URI. mod_rewrite does not alter the |
458 | 467 | # REQUEST_URI, and therefore mod_rewrite by itself is not always enough to |
|
472 | 481 | RewriteRule ^/weblog(/archive|)/(\d+)/?$ https://blog.creativecommons.org/$2 [L] |
473 | 482 | RewriteRule ^/weblog/?$ https://blog.creativecommons.org/ [L] |
474 | 483 | RewriteRule ^/press-releases/entry/(\d+)/?$ https://blog.creativecommons.org/index.php?p=$1 [L] |
475 | | - |
| 484 | + |
476 | 485 | # Catch any requests for the general /weblog/archive and also to the |
477 | 486 | # archives for any particular year/month and then redirect the client |
478 | 487 | # to the new-style permalink |
479 | 488 | RewriteRule ^/weblog/archive(/?.*)$ https://blog.creativecommons.org$1 [L,R=301] |
480 | | - |
| 489 | + |
481 | 490 | # Catch any old permalinks that point to long, ugly post names. The |
482 | 491 | # CC Permalink Mapper will get this request and redirect the user accordingly. |
483 | 492 | # But don't do this if someone was trying to access some particular feed |
484 | 493 | RewriteCond %{REQUEST_URI} !^/([a-z-]+)/\d{4}/\d{2}/feed |
485 | 494 | RewriteRule ^/([a-z-]+)/\d{4}/\d{2}/([a-zA-Z0-9-]+)/?$ /index.php?post_name=$2&category=$1&roflcopter [L] |
486 | | - |
| 495 | + |
487 | 496 | # '<some path>/rss' returns an RSS 0.92 feed, which we don't want, so make any |
488 | 497 | # requests for '<some path>/rss' return an RSS 2 feed. |
489 | | - RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L] |
| 498 | + RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L] |
490 | 499 |
|
491 | 500 | RewriteRule ^/feed/(.*?)?$ https://blog.creativecommons.org/feed/?$1 [L] |
492 | 501 |
|
493 | 502 | # Get missing upload files from the main site |
494 | | - # NOTE: disable in production - for staging sites only (so media URLs will work) |
| 503 | + # NOTE: disable in production - for staging sites only (so media URLs will |
| 504 | + # work) |
495 | 505 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f |
496 | 506 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d |
497 | 507 | RewriteRule ^/(wp-content/uploads/.*)$ http://creativecommons.org/$1 [L] |
498 | | - |
| 508 | + |
499 | 509 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f |
500 | 510 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d |
501 | | -# Breaks fcgi etc. Needs constraining to dirs where needed if used |
502 | | -# RewriteRule . /index.php [L] |
| 511 | + # Breaks fcgi etc. Needs constraining to dirs where needed if used |
| 512 | + # RewriteRule . /index.php [L] |
503 | 513 |
|
504 | 514 | </VirtualHost> |
| 515 | +# vim: ft=apache ts=4 sw=4 sts=4 sr et: |
0 commit comments