Skip to content

Commit 34cf606

Browse files
committed
whitespace and misc cleanup
1 parent 289de61 commit 34cf606

File tree

1 file changed

+41
-43
lines changed

1 file changed

+41
-43
lines changed

default

+41-43
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,60 @@
1+
# vim: ft=apache ts=4 sw=4 sts=4 sr et:
12
<VirtualHost *:80>
2-
#UseCanonicalName Off
3-
43
ServerName MAGICALPONY.legal.creativecommons.org
54

65
VirtualDocumentRoot /srv/clones/MAGICALPONY/docroot
76
DocumentRoot /srv/clones/MAGICALPONY/docroot
87

98
RewriteEngine on
10-
9+
1110
#----------
1211
# Logging. Uncomment these lines and adjust the log level for debugging. Make
1312
# sure to recomment them and restart Apache when done because the file will
1413
# become immense in a hurry.
1514
#----------
16-
15+
1716
#RewriteLog /tmp/rewrite.log
1817
#RewriteLogLevel 5
19-
18+
2019
#----------
2120
# Config
2221
#----------
23-
22+
2423
RewriteMap uppercase int:toupper
25-
24+
2625
#----------
2726
# License engine and legalcode
2827
#----------
29-
28+
3029
Alias /ccengine-fcgi /srv/creativecommons.org/python_env/bin/ccengine.fcgi
3130
Alias /cc.engine-cache /srv/creativecommons.org/python_env/cache
32-
31+
3332
# Redirect all /license to /choose before we go any deeper
3433
RewriteRule ^/choose$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/choose/ [L,R=301]
3534
RewriteRule ^/license$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/choose/ [L,R=301]
36-
35+
3736
# Fixes this repercussions of this bug:
3837
# http://code.creativecommons.org/issues/issue898
3938
RewriteRule ^/licenses/CC0/1.0(.*)$ /publicdomain/zero/1.0$1 [L,R=301]
40-
39+
4140
# Legalcode rewrites
42-
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
41+
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
4342
RewriteRule ^/legalcode %{SERVER_PROTOCOL}://%{HTTP_HOST}/ [L,R=301]
4443
RewriteRule .*legalcode/$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/ [L,R=301]
45-
RewriteRule ^/licenses/(.*)sampling\+/1.0/(.*)/legalcode$ /legalcode/$1samplingplus_1.0_$2.html [L]
46-
RewriteRule ^/licenses/(.*)sampling\+/1.0/legalcode$ /legalcode/$1samplingplus_1.0.html [L]
44+
RewriteRule ^/licenses/(.*)sampling\+/1.0/(.*)/legalcode$ /legalcode/$1samplingplus_1.0_$2.html [L]
45+
RewriteRule ^/licenses/(.*)sampling\+/1.0/legalcode$ /legalcode/$1samplingplus_1.0.html [L]
4746
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode\.([A-Za-z-]+)$ /legalcode/$1_$2_$3_$4.html [L]
48-
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z])$ /legalcode/$1_$2_$3.html [L]
49-
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode$ /legalcode/$1_$2_$3.html [L]
50-
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
51-
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L]
52-
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
47+
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z])$ /legalcode/$1_$2_$3.html [L]
48+
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode$ /legalcode/$1_$2_$3.html [L]
49+
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
50+
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L]
51+
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
5352
# -Aaa is for Chinese
54-
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]
53+
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]
5554
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L]
56-
55+
5756
# License RDF rewrites
58-
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
57+
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
5958
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/license_rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml]
6059
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml]
6160
RewriteRule ^/licenses/index.rdf$ /rdf/index.rdf [L,T=application/rdf+xml]
@@ -64,14 +63,14 @@
6463
RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/license_rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml]
6564
RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml]
6665
RewriteRule .*rdf/$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/ [L,R=301]
67-
66+
6867
# See if deed is cached before sending to cc.engine
69-
# FIXME: eval memcache as an alternative?
68+
# FIXME: eval memcache as an alternative?
7069
RewriteCond %{REQUEST_URI} ^/licenses
7170
RewriteCond /srv/clones/MAGICALPONY/python_env/cache/%{REQUEST_FILENAME} -s
7271
RewriteRule ^/licenses/(.*) /cc.engine-cache/licenses/$1 [L,PT]
73-
74-
# FIXME: do we really need rewrites for other licenses like GPL, etc?
72+
73+
# FIXME: do we really need rewrites for other licenses like GPL, etc?
7574
RewriteRule (.*)licence(.*) %{SERVER_PROTOCOL}://%{HTTP_HOST}$1license$2 [L,R=301]
7675
RewriteRule ^/(license|choose|characteristic|publicdomain)$ /$1/ [L,R=301]
7776
RewriteRule ^/(license|choose|characteristic|publicdomain)/(.*) /ccengine-fcgi/$1/$2 [PT,L]
@@ -187,6 +186,8 @@
187186
RewriteRule ^/press-releases/entry/40938 /press-releases/entry/40935 [L,R=301]
188187
RewriteRule ^/weblog/entry/40938 /press-releases/entry/40935 [L,R=301]
189188

189+
RewriteRule ^/weblog/entry/([-a-z0-9]+) /index.php?p=$1 [L,R=301]
190+
190191
#----------
191192
# Farming out old/removed CC.org content to CC Wiki
192193
#----------
@@ -246,11 +247,11 @@
246247

247248
RewriteRule ^/government https://creativecommons.org/publicpolicy [L,R=301]
248249

249-
#----------
250+
#----------
250251
# Redirects to CC.net
251-
#----------
252-
# FIXME: a bunch of these have moved / don't exist anymore
253-
252+
#----------
253+
# FIXME: a bunch of these have moved / don't exist anymore
254+
254255
RewriteRule ^/about/affiliates.*$ https://creativecommons.net/supporters [R=301,L]
255256
RewriteRule ^/about/lessigletter.*$ https://creativecommons.net/letters [L,R=301]
256257
RewriteRule ^/about/supporters$ https://creativecommons.net/supporters [L,R=301]
@@ -264,13 +265,13 @@
264265
#----------
265266
# Miscellaneous
266267
#----------
267-
268+
268269
# Map backwardly named license types to their actual location
269270
RewriteRule ^/licenses/by-nc-nd/1.0/(.*)$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/licenses/by-nd-nc/1.0/$1 [L,R=301]
270271
RewriteRule ^/licenses/by-nd-nc/2.0/(.*)$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/licenses/by-nc-nd/2.0/$1 [L,R=301]
271-
272+
272273
# Map the namespace document and schema URLs
273-
# FIXME: are symlinks cleaner?
274+
# FIXME: are symlinks cleaner?
274275
RewriteRule ^/ns$ /rdf/ns.html [L]
275276
RewriteRule ^/schema.rdf$ /rdf/schema.rdf [L]
276277

@@ -301,41 +302,41 @@
301302
#----------
302303
# WordPress rules here instead of .htaccess
303304
#----------
304-
305+
305306
# NOTE: sometimes Wordpress decides what page to display based on both the
306307
# query string AND the REQUEST_URI. mod_rewrite does not alter the
307308
# REQUEST_URI, and therefore mod_rewrite by itself is not always enough to
308309
# coerce Wordpress into doing what we want. In these case, add the query
309310
# argument '&roflcopter' to whatever RewriteRule. This will signal a special
310311
# plugin (cc_rewrite_request_uri.php) to actually alter the REQUEST_URI in the
311312
# PHP environment to be equivalent to the right side of the RewriteRule.
312-
313+
313314
# Catch requests to certain posts and feed them to Wordpress in a way that
314315
# it knows how to handle
315316
RewriteRule ^/weblog(/archive|)/entry/(\d+)/?$ /index.php?p=$2&%{QUERY_STRING}&roflcopter [L]
316317
RewriteRule ^/press-releases/entry/(\d+)/?$ /index.php?p=$1&roflcopter [L]
317-
318+
318319
# Catch any requests for the general /weblog/archive and also to the
319320
# archives for any particular year/month and then redirect the client
320321
# to the new-style permalink
321322
RewriteRule ^/weblog/archive(/?.*)$ %{SERVER_PROTOCOL}://%{HTTP_HOST}/weblog$1 [L,R=301]
322-
323+
323324
# Catch any old permalinks that point to long, ugly post names. The
324325
# CC Permalink Mapper will get this request and redirect the user accordingly.
325326
# But don't do this if someone was trying to access some particular feed
326327
RewriteCond %{REQUEST_URI} !^/([a-z-]+)/\d{4}/\d{2}/feed
327328
RewriteRule ^/([a-z-]+)/\d{4}/\d{2}/([a-zA-Z0-9-]+)/?$ /index.php?post_name=$2&category=$1&roflcopter [L]
328-
329+
329330
# '<some path>/rss' returns an RSS 0.92 feed, which we don't want, so make any
330331
# requests for '<some path>/rss' return an RSS 2 feed.
331332
RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L]
332-
333+
333334
# Get missing upload files from the main site
334335
# NOTE: disable in production - for staging sites only (so media URLs will work)
335336
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
336337
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
337338
RewriteRule ^/(wp-content/uploads/.*)$ %{SERVER_PROTOCOL}://creativecommons.org/$1 [L]
338-
339+
339340
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
340341
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
341342
RewriteRule . /index.php [L]
@@ -354,9 +355,6 @@
354355
Require all granted
355356
</Location>
356357

357-
RewriteEngine On
358-
#RewriteLog "/var/log/apache2/rewrite.log"
359-
#RewriteLogLevel 3
360358
LogLevel alert rewrite:trace3
361359

362360
</VirtualHost>

0 commit comments

Comments
 (0)