|
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 | 172 |
|
|
194 | 194 | # http://code.creativecommons.org/issues/issue898 |
195 | 195 | RewriteRule ^/licenses/cc0/1.0(.*)$ https://creativecommons.org/publicdomain/zero/1.0$1 [L,R=301] |
196 | 196 | RewriteRule ^/licenses/CC0/1.0(.*)$ https://creativecommons.org/publicdomain/zero/1.0$1 [L,R=301] |
197 | | - # And #694 |
| 197 | + # And #694 |
198 | 198 | RewriteRule ^/licenses/zero/1.0/(.*)$ https://creativecommons.org/publicdomain/zero/1.0/$1 [L,R=301] |
199 | | - |
| 199 | + |
200 | 200 | # Address https://github.com/creativecommons/creativecommons.org/issues/563 |
201 | 201 | RewriteRule ^/publicdomain/zero/1.0/deed.en/$ https://creativecommons.org/publicdomain/zero/1.0/deed.en [L,R=301] |
202 | | - |
| 202 | + |
203 | 203 | # Legalcode rewrites |
204 | | - # 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 |
205 | 205 | RewriteRule ^/legalcode http://creativecommons.org/ [L,R=301] |
206 | 206 | RewriteRule .*legalcode/$ http://creativecommons.org/ [L,R=301] |
207 | | - 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] |
208 | 208 | RewriteRule ^/licenses/(.*)sampling\+/1.0/legalcode$ /legalcode/$1samplingplus_1.0.html [L] |
209 | 209 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L] |
210 | 210 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L] |
211 | 211 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode\.([A-Za-z-]+)$ /legalcode/$1_$2_$3_$4.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] |
| 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] |
214 | 214 | RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L] |
215 | 215 | RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L] |
216 | 216 | # Legalcodes can have extensions of the form .fr or .zh-Hant |
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] |
| 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] |
218 | 218 |
|
219 | 219 | # License RDF rewrites |
220 | | - # 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 |
221 | 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] |
222 | 222 | RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
223 | 223 | RewriteRule ^/licenses/index.rdf$ /rdf/index.rdf [L,T=application/rdf+xml] |
|
226 | 226 | RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/license_rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
227 | 227 | RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml] |
228 | 228 | RewriteRule .*rdf/$ http://creativecommons.org/ [L,R=301] |
229 | | - |
| 229 | + |
230 | 230 | # See if deed is cached before sending to cc.engine |
231 | | - # FIXME: eval memcache as an alternative? |
| 231 | + # FIXME: eval memcache as an alternative? |
232 | 232 | RewriteCond %{REQUEST_URI} ^/licenses |
233 | 233 | RewriteCond /var/www/creativecommons.org//python_env/cache/%{REQUEST_FILENAME} -s |
234 | 234 | RewriteRule ^/licenses/(.*) /cc.engine-cache/licenses/$1 [L,PT] |
235 | 235 |
|
236 | | - # 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? |
237 | 237 | RewriteRule (.*)licence(.*) https://creativecommons.org$1license$2 [L,R=301] |
238 | 238 | RewriteRule ^/(license|choose|characteristic|publicdomain)$ http://creativecommons.org/$1/ [L,R=301] |
239 | 239 | RewriteRule ^/(license|choose|characteristic|publicdomain)/(.*) /ccengine-fcgi/$1/$2 [PT,L] |
|
407 | 407 |
|
408 | 408 | RewriteRule ^/government http://creativecommons.org/publicpolicy [L,R=301] |
409 | 409 |
|
410 | | - #---------- |
| 410 | + #---------- |
411 | 411 | # Redirects to CC.net |
412 | | - #---------- |
413 | | - # FIXME: a bunch of these have moved / don't exist anymore |
414 | | - |
| 412 | + #---------- |
| 413 | + # FIXME: a bunch of these have moved / don't exist anymore |
415 | 414 | RewriteRule ^/about/affiliates.*$ http://creativecommons.net/supporters [R=301,L] |
416 | 415 | RewriteRule ^/about/lessigletter.*$ http://creativecommons.net/letters [L,R=301] |
417 | 416 | RewriteRule ^/about/supporters$ http://creativecommons.net/supporters [L,R=301] |
|
425 | 424 | #---------- |
426 | 425 | # Miscellaneous |
427 | 426 | #---------- |
428 | | - |
429 | 427 | # Map backwardly named license types to their actual location |
430 | 428 | RewriteRule ^/licenses/by-nc-nd/1.0/(.*)$ http://creativecommons.org/licenses/by-nd-nc/1.0/$1 [L,R=301] |
431 | 429 | RewriteRule ^/licenses/by-nd-nc/2.0/(.*)$ http://creativecommons.org/licenses/by-nc-nd/2.0/$1 [L,R=301] |
432 | | - |
| 430 | + |
433 | 431 | # Map the namespace document and schema URLs |
434 | | - # FIXME: are symlinks cleaner? |
| 432 | + # FIXME: are symlinks cleaner? |
435 | 433 | RewriteRule ^/ns$ /rdf/ns.html [L] |
436 | 434 | RewriteRule ^/schema.rdf$ /rdf/schema.rdf [L] |
437 | 435 |
|
|
463 | 461 | #---------- |
464 | 462 | # WordPress rules here instead of .htaccess |
465 | 463 | #---------- |
466 | | - |
| 464 | + |
467 | 465 | # NOTE: sometimes Wordpress decides what page to display based on both the |
468 | 466 | # query string AND the REQUEST_URI. mod_rewrite does not alter the |
469 | 467 | # REQUEST_URI, and therefore mod_rewrite by itself is not always enough to |
|
483 | 481 | RewriteRule ^/weblog(/archive|)/(\d+)/?$ https://blog.creativecommons.org/$2 [L] |
484 | 482 | RewriteRule ^/weblog/?$ https://blog.creativecommons.org/ [L] |
485 | 483 | RewriteRule ^/press-releases/entry/(\d+)/?$ https://blog.creativecommons.org/index.php?p=$1 [L] |
486 | | - |
| 484 | + |
487 | 485 | # Catch any requests for the general /weblog/archive and also to the |
488 | 486 | # archives for any particular year/month and then redirect the client |
489 | 487 | # to the new-style permalink |
490 | 488 | RewriteRule ^/weblog/archive(/?.*)$ https://blog.creativecommons.org$1 [L,R=301] |
491 | | - |
| 489 | + |
492 | 490 | # Catch any old permalinks that point to long, ugly post names. The |
493 | 491 | # CC Permalink Mapper will get this request and redirect the user accordingly. |
494 | 492 | # But don't do this if someone was trying to access some particular feed |
495 | 493 | RewriteCond %{REQUEST_URI} !^/([a-z-]+)/\d{4}/\d{2}/feed |
496 | 494 | RewriteRule ^/([a-z-]+)/\d{4}/\d{2}/([a-zA-Z0-9-]+)/?$ /index.php?post_name=$2&category=$1&roflcopter [L] |
497 | | - |
| 495 | + |
498 | 496 | # '<some path>/rss' returns an RSS 0.92 feed, which we don't want, so make any |
499 | 497 | # requests for '<some path>/rss' return an RSS 2 feed. |
500 | | - RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L] |
| 498 | + RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L] |
501 | 499 |
|
502 | 500 | RewriteRule ^/feed/(.*?)?$ https://blog.creativecommons.org/feed/?$1 [L] |
503 | 501 |
|
504 | 502 | # Get missing upload files from the main site |
505 | | - # 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) |
506 | 505 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f |
507 | 506 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d |
508 | 507 | RewriteRule ^/(wp-content/uploads/.*)$ http://creativecommons.org/$1 [L] |
509 | | - |
| 508 | + |
510 | 509 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f |
511 | 510 | RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d |
512 | | -# Breaks fcgi etc. Needs constraining to dirs where needed if used |
513 | | -# RewriteRule . /index.php [L] |
| 511 | + # Breaks fcgi etc. Needs constraining to dirs where needed if used |
| 512 | + # RewriteRule . /index.php [L] |
514 | 513 |
|
515 | 514 | </VirtualHost> |
| 515 | +# vim: ft=apache ts=4 sw=4 sts=4 sr et: |
0 commit comments