Skip to content

Commit

Permalink
cleaned-up whitespace and added vim modeline
Browse files Browse the repository at this point in the history
  • Loading branch information
TimidRobot committed Nov 5, 2018
1 parent cb472f5 commit 0a055ce
Showing 1 changed file with 70 additions and 69 deletions.
139 changes: 70 additions & 69 deletions config/livechooser/000-default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ServerName chooser.productionwww.creativecommons.uk0.bigv.io
#ServerName creativecommons.org
DocumentRoot /var/www/creativecommons.org/docroot

# CloudFlare doesn't like ranges - 20150804-rob.
Header set Accept-Ranges none

Expand All @@ -11,15 +11,15 @@

# For munin
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Require local
</Location>
<Location /server-status>
SetHandler server-status
Require local
</Location>
</IfModule>

<Directory /var/www/html>
Options -Indexes
Require all granted
Options -Indexes
Require all granted
</Directory>

#ErrorLog /dev/null
Expand Down Expand Up @@ -61,7 +61,7 @@
DirectoryIndex deed
DefaultType text/html
AddDefaultCharset utf-8
Require all granted
Require all granted
</Location>

# Always serve up deeds as text/html, even when the country code
Expand All @@ -80,102 +80,102 @@
### ------------------------- ####
## BEGIN mod_rewrite section ##
### ------------------------- ####

RewriteEngine on

#----------
# Logging. Uncomment these lines and adjust the log level for debugging. Make
# sure to recomment them and restart Apache when done because the file will
# become immense in a hurry.
#----------

#RewriteLog /tmp/rewrite.log
#RewriteLogLevel 5

#----------
# Config
#----------

RewriteMap uppercase int:toupper

#----------
# License engine and legalcode
#----------

ScriptAlias /ccengine-fcgi /var/www/creativecommons.org/python_env/bin/ccengine.fcgi
<Location /ccengine-fcgi>
AllowOverride all
DefaultType text/html
AddDefaultCharset utf-8
# # #Require local
# # Require all granted
ScriptAlias /ccengine-fcgi /var/www/creativecommons.org/python_env/bin/ccengine.fcgi
<Location /ccengine-fcgi>
AllowOverride all
DefaultType text/html
AddDefaultCharset utf-8
#Require local
#Require all granted
</Location>

Alias /cc.engine-cache /var/www/creativecommons.org/python_env/cache
<Location /cc.engine-cache>
AllowOverride all
DefaultType text/html
AddDefaultCharset utf-8
Require all granted
Require all granted
</Location>

<Directory /var/www/creativecommons.org/python_env/cache>
Require all granted
Require all granted
</Directory>

<Directory /var/www/creativecommons.org/python_env/bin>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Require local
Require all granted
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Require local
Require all granted
</Directory>

#RewriteRule "^/discover/gift-guide(.*)$" "/wp-content/themes/creativecommons.org/discover/gift-guide/$1" [PT]
#Alias /discover/gift-guide/ /var/www/cc-wp-theme/creativecommons.org/discover/gift-guide/
#Alias /discover/gift-guide/ /var/www/cc-wp-theme/creativecommons.org/discover/gift-guide/
#Alias /discover/gift-guide /var/www/creativecommons.org/discover/gift-guide
<Directory /var/www/creativecommons.org/discover/gift-guide>
Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# Order allow,deny
# Allow from all
# Require all granted
# Satisfy Any
#AllowOverride All
#Order allow,deny
#Allow from all
#Require all granted
#Satisfy Any
</Directory>

<Directory /var/www/creativecommons.org/faq/>
Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# Order allow,deny
# Allow from all
# Require all granted
# Satisfy Any
#AllowOverride All
#Order allow,deny
#Allow from all
#Require all granted
#Satisfy Any
</Directory>

# Redirect all /license to /choose before we go any deeper
RewriteRule ^/choose$ http://creativecommons.org/choose/ [L,R=301]
RewriteRule ^/license$ http://creativecommons.org/choose/ [L,R=301]

# Fixes this repercussions of this bug:
# http://code.creativecommons.org/issues/issue898
RewriteRule ^/licenses/CC0/1.0(.*)$ /publicdomain/zero/1.0$1 [L,R=301]

# Legalcode rewrites
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
RewriteRule ^/legalcode http://creativecommons.org/ [L,R=301]
RewriteRule .*legalcode/$ http://creativecommons.org/ [L,R=301]
RewriteRule ^/licenses/(.*)sampling\+/1.0/(.*)/legalcode$ /legalcode/$1samplingplus_1.0_$2.html [L]
RewriteRule ^/licenses/(.*)sampling\+/1.0/legalcode$ /legalcode/$1samplingplus_1.0.html [L]
RewriteRule ^/licenses/(.*)sampling\+/1.0/(.*)/legalcode$ /legalcode/$1samplingplus_1.0_$2.html [L]
RewriteRule ^/licenses/(.*)sampling\+/1.0/legalcode$ /legalcode/$1samplingplus_1.0.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode\.([A-Za-z-]+)$ /legalcode/$1_$2_$3_$4.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z])$ /legalcode/$1_$2_$3.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode$ /legalcode/$1_$2_$3.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L]
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z])$ /legalcode/$1_$2_$3.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z])$ /legalcode/$1_$2_$3.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/(.*)/legalcode$ /legalcode/$1_$2_$3.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L]
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode$ /legalcode/$1_$2.html [L]
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.([a-z][a-z])$ /legalcode/$1_$2_$3.html [L]
RewriteRule ^/publicdomain/(.*)/([0-9]\.[0-9])/legalcode\.txt$ /legalcode/$1_$2.txt [L]

# License RDF rewrites
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
# FIXME: eval whether we should use the LHS as the actual file structure so we don't need the rewrites
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/license_rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml]
RewriteRule ^/licenses/(.*)/([0-9]\.[0-9])/([a-z]+)/rdf$ /license_rdf/creativecommons.org_licenses_$1_$2_$3_.rdf [L,T=application/rdf+xml]
RewriteRule ^/licenses/index.rdf$ /rdf/index.rdf [L,T=application/rdf+xml]
Expand All @@ -184,14 +184,14 @@ Require local
RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/license_rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml]
RewriteRule ^/(publicdomain|licenses)/(.*)/([0-9]\.[0-9])/rdf$ /license_rdf/creativecommons.org_$1_$2_$3_.rdf [L,T=application/rdf+xml]
RewriteRule .*rdf/$ http://creativecommons.org/ [L,R=301]

# See if deed is cached before sending to cc.engine
# FIXME: eval memcache as an alternative?
# FIXME: eval memcache as an alternative?
RewriteCond %{REQUEST_URI} ^/licenses
RewriteCond /var/www/creativecommons.org//python_env/cache/%{REQUEST_FILENAME} -s
RewriteRule ^/licenses/(.*) /cc.engine-cache/licenses/$1 [L,PT]
# FIXME: do we really need rewrites for other licenses like GPL, etc?

# FIXME: do we really need rewrites for other licenses like GPL, etc?
RewriteRule (.*)licence(.*) http://creativecommons.org$1license$2 [L,R=301]
RewriteRule ^/(license|choose|characteristic|publicdomain)$ http://creativecommons.org/$1/ [L,R=301]
RewriteRule ^/(license|choose|characteristic|publicdomain)/(.*) /ccengine-fcgi/$1/$2 [PT,L]
Expand Down Expand Up @@ -366,11 +366,11 @@ Require local

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

#----------
#----------
# Redirects to CC.net
#----------
# FIXME: a bunch of these have moved / don't exist anymore
#----------
# FIXME: a bunch of these have moved / don't exist anymore

RewriteRule ^/about/affiliates.*$ http://creativecommons.net/supporters [R=301,L]
RewriteRule ^/about/lessigletter.*$ http://creativecommons.net/letters [L,R=301]
RewriteRule ^/about/supporters$ http://creativecommons.net/supporters [L,R=301]
Expand All @@ -384,13 +384,13 @@ Require local
#----------
# Miscellaneous
#----------

# Map backwardly named license types to their actual location
RewriteRule ^/licenses/by-nc-nd/1.0/(.*)$ http://creativecommons.org/licenses/by-nd-nc/1.0/$1 [L,R=301]
RewriteRule ^/licenses/by-nd-nc/2.0/(.*)$ http://creativecommons.org/licenses/by-nc-nd/2.0/$1 [L,R=301]

# Map the namespace document and schema URLs
# FIXME: are symlinks cleaner?
# FIXME: are symlinks cleaner?
RewriteRule ^/ns$ /rdf/ns.html [L]
RewriteRule ^/schema.rdf$ /rdf/schema.rdf [L]

Expand Down Expand Up @@ -424,11 +424,11 @@ Require local
# https://github.com/creativecommons/creativecommons.org/issues/568

Redirect permanent /chooser https://creativecommons.org/choose/

#----------
# WordPress rules here instead of .htaccess
#----------

# NOTE: sometimes Wordpress decides what page to display based on both the
# query string AND the REQUEST_URI. mod_rewrite does not alter the
# REQUEST_URI, and therefore mod_rewrite by itself is not always enough to
Expand All @@ -448,21 +448,21 @@ Require local
RewriteRule ^/weblog(/archive|)/(\d+)/?$ https://blog.creativecommons.org/$2 [L]
RewriteRule ^/weblog/?$ https://blog.creativecommons.org/ [L]
RewriteRule ^/press-releases/entry/(\d+)/?$ https://blog.creativecommons.org/index.php?p=$1 [L]

# Catch any requests for the general /weblog/archive and also to the
# archives for any particular year/month and then redirect the client
# to the new-style permalink
RewriteRule ^/weblog/archive(/?.*)$ https://blog.creativecommons.org$1 [L,R=301]

# Catch any old permalinks that point to long, ugly post names. The
# CC Permalink Mapper will get this request and redirect the user accordingly.
# But don't do this if someone was trying to access some particular feed
RewriteCond %{REQUEST_URI} !^/([a-z-]+)/\d{4}/\d{2}/feed
RewriteRule ^/([a-z-]+)/\d{4}/\d{2}/([a-zA-Z0-9-]+)/?$ /index.php?post_name=$2&category=$1&roflcopter [L]

# '<some path>/rss' returns an RSS 0.92 feed, which we don't want, so make any
# requests for '<some path>/rss' return an RSS 2 feed.
RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L]
RewriteRule ^/(.*?)rss/?$ /index.php/$1?feed=rss2 [L]

RewriteRule ^/feed/(.*?)?$ https://blog.creativecommons.org/feed/?$1 [L]

Expand All @@ -471,10 +471,11 @@ Require local
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^/(wp-content/uploads/.*)$ http://creativecommons.org/$1 [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
# Breaks fcgi etc. Needs constraining to dirs where needed if used
#RewriteRule . /index.php [L]

</VirtualHost>
# vim: ft=apache ts=4 sw=4 sts=4 sr et

0 comments on commit 0a055ce

Please sign in to comment.