Options FollowSymLinks AddDefaultCharset utf-8 RewriteEngine On # the main rewrite rule for the frontend application RewriteCond %{REQUEST_URI} !^/(backend/web|admin|storage) RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L] # redirect to the page without a trailing slash (uncomment if necessary) #RewriteCond %{REQUEST_URI} ^/admin/$ #RewriteRule ^(admin)/ /$1 [L,R=301] # the main rewrite rule for the backend application RewriteCond %{REQUEST_URI} ^/admin RewriteRule ^admin(.*) /backend/web/$1 [L] RewriteCond %{REQUEST_FILENAME} robots.txt RewriteRule . /frontend/web/index.php [L] # if a directory or a file of the uploads folder exists, use the request directly RewriteCond %{REQUEST_URI} ^/storage RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php of grontend app RewriteRule . /frontend/web/index.php [L] # if a directory or a file of the frontend application exists, use the request directly RewriteCond %{REQUEST_URI} ^/frontend/web RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php RewriteRule . /frontend/web/index.php [L] # if a directory or a file of the backend application exists, use the request directly RewriteCond %{REQUEST_URI} ^/backend/web RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php RewriteRule . /backend/web/index.php [L] RewriteCond %{REQUEST_URI} \.(htaccess|htpasswd|svn|git) RewriteRule \.(htaccess|htpasswd|svn|git) - [F] AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html Header append Vary User-Agent RewriteEngine On AddEncoding gzip .gz RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)$ $1.gz [QSA,L] # Turn on the module. ExpiresActive on ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/ico "access plus 1 month" ExpiresByType image/x-icon "access plus 1 month" ExpiresByType text/html "access plus 600 seconds" ExpiresByType text/javascript "access 1 week" ExpiresByType text/css "access 1 week" # Set the default expiry times. ExpiresDefault "access plus 1 week" Header set Cache-Control "max-age=604800, public"