|
| 1 | +ServerName localhost:8080 |
| 2 | + |
| 3 | +<VirtualHost *:80> |
| 4 | + ErrorLog ${APACHE_LOG_DIR}/error.log |
| 5 | + CustomLog ${APACHE_LOG_DIR}/access.log combined |
| 6 | + |
| 7 | + RewriteEngine On |
| 8 | + |
| 9 | + ########################################################################### |
| 10 | + # Set conservative/secure defaults |
| 11 | + <Directory /> |
| 12 | + AllowOverride None |
| 13 | + DirectoryIndex index.html |
| 14 | + Options -Indexes |
| 15 | + </Directory> |
| 16 | + # Git |
| 17 | + <DirectoryMatch "/\.git"> |
| 18 | + Require all denied |
| 19 | + </DirectoryMatch> |
| 20 | + # Subversion |
| 21 | + <DirectoryMatch "/\.svn"> |
| 22 | + Require all denied |
| 23 | + </DirectoryMatch> |
| 24 | + # Deny access to accidental uploads of macOS-specific directories and files |
| 25 | + # .DS_Store |
| 26 | + <FilesMatch "^(\._)?\.[Dd][Ss]_[Ss]tore"> |
| 27 | + Require all denied |
| 28 | + </FilesMatch> |
| 29 | + # resource forks |
| 30 | + <DirectoryMatch "/__MACOSX"> |
| 31 | + Require all denied |
| 32 | + </DirectoryMatch> |
| 33 | + |
| 34 | + ########################################################################### |
| 35 | + # CC Legal Tools |
| 36 | + # Directory Aliases |
| 37 | + Alias /status /var/www/git/cc-legal-tools-data/docs/status |
| 38 | + Alias /rdf /var/www/git/cc-legal-tools-data/docs/rdf |
| 39 | + Alias /publicdomain /var/www/git/cc-legal-tools-data/docs/publicdomain |
| 40 | + Alias /licenses /var/www/git/cc-legal-tools-data/docs/licenses |
| 41 | + Alias /cc-legal-tools /var/www/git/cc-legal-tools-data/docs/cc-legal-tools |
| 42 | + # File Aliases |
| 43 | + Alias /schema.rdf /var/www/git/cc-legal-tools-data/docs/rdf/schema.rdf |
| 44 | + Alias /ns.html /var/www/git/cc-legal-tools-data/docs/rdf/ns.html |
| 45 | + Alias /ns /var/www/git/cc-legal-tools-data/docs/rdf/ns.html |
| 46 | + <Directory /var/www/git/cc-legal-tools-data/docs> |
| 47 | + # Disable .htaccess (for security and performance) |
| 48 | + AllowOverride None |
| 49 | + # Also serve HTML files without .html extension |
| 50 | + RewriteCond %{REQUEST_FILENAME}.html -f |
| 51 | + RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L] |
| 52 | + # Redirect .../index.php to .../ |
| 53 | + RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC] |
| 54 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 55 | + RewriteRule (.*/)index\.php$ $1 [L,NC,R=301] |
| 56 | + # Deny access to PHP files (content should be only static files) |
| 57 | + RewriteRule .*\.php$ "-" [F,L] |
| 58 | + # Correct mimetype for .../rdf files |
| 59 | + RewriteRule (.*/rdf$) $1 [T=application/rdf+xml] |
| 60 | + </Directory> |
| 61 | + |
| 62 | + ########################################################################### |
| 63 | + # Chooser |
| 64 | + Alias /choose /var/www/git/chooser/docs |
| 65 | + <Directory /var/www/git/chooser/docs> |
| 66 | + # Disable .htaccess (for security and performance) |
| 67 | + AllowOverride None |
| 68 | + # Redirect .../index.php to .../ |
| 69 | + RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC] |
| 70 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 71 | + RewriteRule (.*/)index\.php$ $1 [L,NC,R=301] |
| 72 | + # Deny access to PHP files (content should be only static files) |
| 73 | + RewriteRule .*\.php "-" [F,L] |
| 74 | + </Directory> |
| 75 | + RedirectPermanent /chooser /choose |
| 76 | + |
| 77 | + ########################################################################### |
| 78 | + # FAQ |
| 79 | + Alias /faq /var/www/git/faq/faq |
| 80 | + <Directory /var/www/git/faq/faq> |
| 81 | + # Disable .htaccess (for security and performance) |
| 82 | + AllowOverride None |
| 83 | + # Redirect .../index.php to .../ |
| 84 | + RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC] |
| 85 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 86 | + RewriteRule (.*/)index\.php$ $1 [L,NC,R=301] |
| 87 | + # Deny access to PHP files (content should be only static files) |
| 88 | + RewriteRule .*\.php "-" [F,L] |
| 89 | + </Directory> |
| 90 | + |
| 91 | + ########################################################################### |
| 92 | + # Platform Toolkit |
| 93 | + Alias /platform/toolkit /var/www/git/mp/docs |
| 94 | + <Directory /var/www/git/mp/docs> |
| 95 | + # Disable .htaccess (for security and performance) |
| 96 | + AllowOverride None |
| 97 | + # Redirect .../index.php to .../ |
| 98 | + RewriteCond %{REQUEST_FILENAME} "index\.php$" [NC] |
| 99 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 100 | + RewriteRule (.*/)index\.php$ $1 [L,NC,R=301] |
| 101 | + # Deny access to PHP files (content should be only static files) |
| 102 | + RewriteRule .*\.php "-" [F,L] |
| 103 | + </Directory> |
| 104 | + |
| 105 | + ########################################################################### |
| 106 | + # WordPress/Default |
| 107 | + RewriteRule ^/licenses/$ /about/cclicenses/ |
| 108 | + RewriteRule ^/publicdomain/$ /about/cclicenses/ |
| 109 | + DocumentRoot /var/www/html |
| 110 | + <Directory /var/www/html> |
| 111 | + # Expected configuration for WordPress |
| 112 | + # (see conf-available/docker-php.conf) |
| 113 | + AllowOverride All |
| 114 | + DirectoryIndex index.php index.html |
| 115 | + |
| 116 | + # WP-API |
| 117 | + RewriteRule ^(/wp-json/.*)$ /index.php$1 [L] |
| 118 | + |
| 119 | + # Permalinks (for dirs/files not found) |
| 120 | + # https://codex.wordpress.org/Using_Permalinks |
| 121 | + # Directory Conditions |
| 122 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 123 | + RewriteCond %{REQUEST_URI} !^/rdf |
| 124 | + RewriteCond %{REQUEST_URI} !^/publicdomain |
| 125 | + RewriteCond %{REQUEST_URI} !^/platform/toolkit |
| 126 | + RewriteCond %{REQUEST_URI} !^/licenses |
| 127 | + RewriteCond %{REQUEST_URI} !^/faq |
| 128 | + RewriteCond %{REQUEST_URI} !^/choose |
| 129 | + RewriteCond %{REQUEST_URI} !^/cc-legal-tools |
| 130 | + # File Conditions |
| 131 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 132 | + RewriteCond %{REQUEST_URI} !^/schema.rdf$ |
| 133 | + RewriteCond %{REQUEST_URI} !^/ns.html$ |
| 134 | + RewriteCond %{REQUEST_URI} !^/ns$ |
| 135 | + # Rule |
| 136 | + RewriteRule . /index.php [L] |
| 137 | + |
| 138 | + </Directory> |
| 139 | + |
| 140 | +</VirtualHost> |
| 141 | + |
| 142 | +# vim: ft=apache ts=4 sw=4 sts=4 sr et |
0 commit comments