|
| 1 | +# Kirby .htaccess |
| 2 | +# revision 2020-06-15 |
| 3 | + |
| 4 | +# rewrite rules |
| 5 | +<IfModule mod_rewrite.c> |
| 6 | + |
| 7 | +# enable awesome urls. i.e.: |
| 8 | +# http://yourdomain.com/about-us/team |
| 9 | +RewriteEngine on |
| 10 | + |
| 11 | +# make sure to set the RewriteBase correctly |
| 12 | +# if you are running the site in a subfolder; |
| 13 | +# otherwise links or the entire site will break. |
| 14 | +# |
| 15 | +# If your homepage is http://yourdomain.com/mysite, |
| 16 | +# set the RewriteBase to: |
| 17 | +# |
| 18 | +# RewriteBase /mysite |
| 19 | + |
| 20 | +# In some environments it's necessary to |
| 21 | +# set the RewriteBase to: |
| 22 | +# |
| 23 | +# RewriteBase / |
| 24 | + |
| 25 | +# block files and folders beginning with a dot, such as .git |
| 26 | +# except for the .well-known folder, which is used for Let's Encrypt and security.txt |
| 27 | +RewriteRule (^|/)\.(?!well-known\/) index.php [L] |
| 28 | + |
| 29 | +# block all files in the content folder from being accessed directly |
| 30 | +RewriteRule ^content/(.*) index.php [L] |
| 31 | + |
| 32 | +# block all files in the site folder from being accessed directly |
| 33 | +RewriteRule ^site/(.*) index.php [L] |
| 34 | + |
| 35 | +# block direct access to Kirby and the Panel sources |
| 36 | +RewriteRule ^kirby/(.*) index.php [L] |
| 37 | + |
| 38 | +# make site links work |
| 39 | +RewriteCond %{REQUEST_FILENAME} !-f |
| 40 | +RewriteCond %{REQUEST_FILENAME} !-d |
| 41 | +RewriteRule ^(.*) index.php [L] |
| 42 | + |
| 43 | +</IfModule> |
| 44 | + |
| 45 | +# pass the Authorization header to PHP |
| 46 | +SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 |
| 47 | + |
| 48 | +# compress text file responses |
| 49 | +<IfModule mod_deflate.c> |
| 50 | +AddOutputFilterByType DEFLATE text/plain |
| 51 | +AddOutputFilterByType DEFLATE text/html |
| 52 | +AddOutputFilterByType DEFLATE text/css |
| 53 | +AddOutputFilterByType DEFLATE text/javascript |
| 54 | +AddOutputFilterByType DEFLATE application/json |
| 55 | +AddOutputFilterByType DEFLATE application/javascript |
| 56 | +AddOutputFilterByType DEFLATE application/x-javascript |
| 57 | +</IfModule> |
0 commit comments