## Set header caching for resources
# Note: to have the following "Expires" section work, enable the following apache modules:
# expires, headers
# e.g. sudo a2enmod headers && sudo a2enmod expires
ExpiresActive On
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType image/vnd.microsoft.icon "access plus 1 months"
ExpiresByType image/x-icon "access plus 1 months"
ExpiresByType image/ico "access plus 1 months"
ExpiresByType text/javascript "access plus 1 months"
ExpiresByType application/javascript "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType text/scss "access plus 1 months"
ExpiresByType text/less "access plus 1 months"
ExpiresByType font/ttf "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
ExpiresByType font/woff2 "access plus 1 month"
ExpiresByType font/svg "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

# https://stackoverflow.com/questions/10296920/how-to-merge-zend-framework-2-module-public-directories
RewriteRule ^resource/([a-zA-Z0-9\.\-]+)/([a-zA-Z0-9\.\-_\/]+)$ index.php?action=resource&module=$1&path=$2 [QSA,L]
RewriteRule ^client_images/([a-zA-Z0-9\.]+)/([a-zA-Z0-9\.\-_\/]+)$ index.php?action=client_images&client=$1&path=$2 [QSA,L]
RewriteRule ^ui/([a-zA-Z0-9\.\-_\/~]+)$ index.php?action=resource&module=UI&path=$1 [QSA,L]
RewriteCond     %{REQUEST_FILENAME} !-f    [OR]
RewriteCond     %{REQUEST_FILENAME} \.php$
RewriteCond     %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ %{ENV:BASE}magl-zf2-legacy-wrapper.php [NC,L]
RewriteEngine   On
# Force HTTPS on the web
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_NAME} resrequest.com/* [NC]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,L,R=permanent]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
