-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathsite.conf
80 lines (77 loc) · 3.31 KB
/
site.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
<VirtualHost *:80>
RewriteEngine On
###########################################################################
# 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
DocumentRoot /usr/local/apache2/htdocs
# Directory Aliases
Alias /status /usr/local/apache2/htdocs/status
Alias /rdf /usr/local/apache2/htdocs/rdf
Alias /publicdomain /usr/local/apache2/htdocs/publicdomain
Alias /licenses /usr/local/apache2/htdocs/licenses
Alias /cc-legal-tools /usr/local/apache2/htdocs/cc-legal-tools
# File Aliases
Alias /schema.rdf /usr/local/apache2/htdocs/rdf/schema.rdf
Alias /ns.html /usr/local/apache2/htdocs/rdf/ns.html
Alias /ns /usr/local/apache2/htdocs/rdf/ns.html
# Ensure lowercase
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} ^/(licenses|publicdomain) [NC]
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^(.*)$ ${lowercase:$1} [R=301,L]
<Directory /usr/local/apache2/htdocs>
# 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]
# Language redirects
Include /usr/local/apache2/conf/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
</VirtualHost>
# vim: ft=apache ts=4 sw=4 sts=4 sr et