-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path000-default.conf
175 lines (161 loc) · 7.38 KB
/
000-default.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
ServerName localhost:8080
<VirtualHost *:80>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
###########################################################################
# Ensure plaintext files are served using UTF-8
AddCharset utf-8 .txt
# Set conservative/secure defaults
<Directory />
AllowOverride None
DirectoryIndex index.html
Options -Indexes
</Directory>
# Git
<DirectoryMatch "/\.git">
Require all denied
</DirectoryMatch>
# Subversion
<DirectoryMatch "/\.svn">
Require all denied
</DirectoryMatch>
# Deny access to accidental uploads of macOS-specific directories and files
# .DS_Store
<FilesMatch "^(\._)?\.[Dd][Ss]_[Ss]tore">
Require all denied
</FilesMatch>
# resource forks
<DirectoryMatch "/__MACOSX">
Require all denied
</DirectoryMatch>
###########################################################################
# CC Legal Tools
# Directory Aliases
Alias /rdf /var/www/git/cc-legal-tools-data/docs/rdf
Alias /publicdomain /var/www/git/cc-legal-tools-data/docs/publicdomain
Alias /licenses /var/www/git/cc-legal-tools-data/docs/licenses
Alias /cc-legal-tools /var/www/git/cc-legal-tools-data/docs/cc-legal-tools
# File Aliases
Alias /schema.rdf /var/www/git/cc-legal-tools-data/docs/rdf/schema.rdf
Alias /ns.html /var/www/git/cc-legal-tools-data/docs/rdf/ns.html
Alias /ns /var/www/git/cc-legal-tools-data/docs/rdf/ns.html
# Ensure lowercase
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} ^/(licenses|publicdomain|rdf) [NC]
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^(.*)$ ${lowercase:$1} [R=301,L]
<Directory /var/www/git/cc-legal-tools-data/docs>
# Disable .htaccess (for security and performance)
AllowOverride None
# Enable CORS (cross-origin resource sharing)
Header set Access-Control-Allow-Origin "*"
# Correct mimetype for .../rdf files
RewriteRule (.*/rdf$) $1 [T=application/rdf+xml]
# Serve RDF/XML when requested, even if URL is for index (deed), deed,
# or legalcode
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteCond %{REQUEST_URI} (/(licenses|publicdomain)/[^/]+/.*)(/.*)
RewriteRule "(.*)(/|/deed.*|/index.*|/legalcode.*)$" "%1/rdf" [R=303]
# Language redirects
Include /var/www/git/cc-legal-tools-data/config/language-redirects
# Also serve HTML files without .html extension
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]
# Redirect .../index.php to .../
RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*/)index\.php$ $1 [L,NC,R=301]
# Deny access to PHP files (content should be only static files)
RewriteRule .*\.php$ "-" [F,L]
</Directory>
# Legacy/compatibilty redirects
RedirectPermanent /licenses/work-html-popup /choose
RedirectPermanent /licences /licenses
# Redirect legacy public domain URLs
RedirectPermanent /licenses/publicdomain/ /publicdomain/
RedirectPermanent /licenses/mark/1.0 /publicdomain/mark/1.0
# Licenses 1.0 has reverse ordered components
RedirectPermanent /licenses/nc-nd/1.0 /licenses/nd-nc/1.0
RedirectPermanent /licenses/by-nc-nd/1.0 /licenses/by-nd-nc/1.0
# Licenses 2.1 only includes ports
RedirectMatch 301 /licenses/([^/]+)/2.1/(lega.*) /licenses/$1/2.0/$2
RedirectMatch 301 /licenses/([^/]+)/2.1/(deed.*) /licenses/$1/2.0/$2
###########################################################################
# Chooser
# Alias /choose /var/www/git/chooser/docs
# <Directory /var/www/git/chooser/docs>
# # Disable .htaccess (for security and performance)
# AllowOverride None
# # Redirect .../index.php to .../
# RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC]
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule (.*/)index\.php$ $1 [L,NC,R=301]
# # Deny access to PHP files (content should be only static files)
# RewriteRule .*\.php "-" [F,L]
# </Directory>
RedirectTemp /chooser https://chooser-beta.creativecommons.org
RedirectTemp /choose/zero https://chooser-beta.creativecommons.org
RedirectTemp /choose/publicdomain https://chooser-beta.creativecommons.org
RedirectTemp /choose/mark/ https://wiki.creativecommons.org/wiki/PDM_FAQ
RedirectTemp /choose/mark https://wiki.creativecommons.org/wiki/PDM_FAQ
RedirectTemp /choose https://chooser-beta.creativecommons.org
###########################################################################
# FAQ
Alias /faq /var/www/git/faq/faq
<Directory /var/www/git/faq/faq>
# Disable .htaccess (for security and performance)
AllowOverride None
# Redirect .../index.php to .../
RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*/)index\.php$ $1 [L,NC,R=301]
# Deny access to PHP files (content should be only static files)
RewriteRule .*\.php "-" [F,L]
</Directory>
###########################################################################
# Platform Toolkit
Alias /platform/toolkit /var/www/git/mp/docs
<Directory /var/www/git/mp/docs>
# Disable .htaccess (for security and performance)
AllowOverride None
# Redirect .../index.php to .../
RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*/)index\.php$ $1 [L,NC,R=301]
# Deny access to PHP files (content should be only static files)
RewriteRule .*\.php "-" [F,L]
</Directory>
###########################################################################
# WordPress/Default
DocumentRoot /var/www/index
<Directory /var/www/index>
# Expected configuration for WordPress
# (see conf-available/docker-php.conf)
AllowOverride All
DirectoryIndex index.php index.html
# WP-API
RewriteRule ^(/wp-json/.*)$ /index.php$1 [L]
# Legacy theme (hotlinked image that gives CC exposure)
RedirectPermanent /wp-content/themes/cc/images/cc.logo.white.svg https://ccstatic.org/cc2016www/images/cc.logo.white.svg
# Permalinks (for dirs/files not found)
# https://codex.wordpress.org/Using_Permalinks
# Directory Conditions
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/rdf
RewriteCond %{REQUEST_URI} !^/publicdomain
RewriteCond %{REQUEST_URI} !^/platform/toolkit
RewriteCond %{REQUEST_URI} !^/licen[cs]es
RewriteCond %{REQUEST_URI} !^/faq
RewriteCond %{REQUEST_URI} !^/choose
RewriteCond %{REQUEST_URI} !^/cc-legal-tools
# File Conditions
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/schema.rdf$
RewriteCond %{REQUEST_URI} !^/ns.html$
RewriteCond %{REQUEST_URI} !^/ns$
# Rule
RewriteRule . /index.php [L]
</Directory>
</VirtualHost>
# vim: ft=apache ts=4 sw=4 sts=4 sr et