# Rewrite rules
<IfModule mod_rewrite.c>
	# enable awesome urls. i.e.:
	# http://yourdomain.com/about-us/team
	RewriteEngine on
	
	# make sure to set the RewriteBase correctly
	# if you are running the site in a subfolder.
	# Otherwise links or the entire site will break.
	#
	# If your homepage is http://yourdomain.com/mysite
	# Set the RewriteBase to:
	#
	RewriteBase /
	
	# rewrite codesigned.de	alternative domain
	RewriteCond %{SERVER_NAME} codesigned.de
	RewriteRule .* https://codesignd.de%{REQUEST_URI} [R=301,L]
	
	# rewrite /favicon.ico
	RewriteRule ^favicon.ico$ assets/img/favicon.ico [L]
	
	# cache busting
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(assets/.+)\.(\d+)\.(\w+)$ $1.$3 [L]
	
	# block text files in the content folder from being accessed directly
	RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]
	
	# block all files in the site folder from being accessed directly
	RewriteRule ^site/(.*) index.php [L]
	
	# block all files in the kirby folder from being accessed directly
	RewriteRule ^kirby/(.*) index.php [L]
	
	# make panel links work
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^panel/(.*) panel/index.php [L]
	
	# make site links work
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.*) index.php [L]
</IfModule>

# Mime types
<IfModule mod_mime.c>
	AddType text/css css
	AddType application/javascript js
	
	AddType image/svg+xml svg
	AddType image/jpeg jpg jpeg
	AddType image/png png
	AddType image/x-icon ico
	
	AddType application/vnd.ms-fontobject eot
	AddType application/font-woff woff
	AddType font/woff2 woff2
	
	AddType application/pgp-keys asc
</IfModule>

# Compression
<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE application/atom+xml \
	                              application/javascript \
	                              application/json \
	                              application/rss+xml \
	                              application/xhtml+xml \
	                              application/xml \
	                              image/svg+xml \
	                              image/x-icon \
	                              text/cache-manifest \
	                              text/css \
	                              text/html \
	                              text/plain
</IfModule>

# Caching
<IfModule mod_expires.c>
	ExpiresActive On
	
	ExpiresByType text/css "modification plus 1 year"
	ExpiresByType application/javascript "modification plus 1 year"
	
	ExpiresByType image/svg+xml "modification plus 1 year"
	ExpiresByType image/jpeg "modification plus 1 year"
	ExpiresByType image/png "modification plus 1 year"
	ExpiresByType image/x-icon "modification plus 1 year"
	
	ExpiresByType application/vnd.ms-fontobject "modification plus 1 year"
	ExpiresByType application/font-woff "modification plus 1 year"
	ExpiresByType font/woff2 "modification plus 1 year"
</IfModule>
