Last active
October 23, 2017 06:43
-
-
Save opencubicles/388799c635186f8b22c1d2b17a410e37 to your computer and use it in GitHub Desktop.
.htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthType Basic | |
AuthName "This is a Restricted Area" | |
AuthUserFile /srv/www/data/.mep.htpasswd | |
require valid-user | |
Options +FollowSymLinks | |
AddDefaultCharset UTF-8 | |
RewriteEngine on | |
DirectoryIndex index.php | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# redirect http to https and non-www to www | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] | |
# if a directory or a file exists, use it directly | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# otherwise forward it to index.php | |
RewriteRule . index.php | |
</IfModule> | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css | |
<FilesMatch "\.(js|css|html|htm|php|xml)$"> | |
SetOutputFilter DEFLATE | |
</FilesMatch> | |
</IfModule> | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresByType image/gif "access plus 1 day" | |
ExpiresByType image/jpeg "access plus 1 day" | |
ExpiresByType image/png "access plus 1 day" | |
ExpiresByType text/css "access plus 1 day" | |
ExpiresByType text/js "access plus 1 day" | |
ExpiresByType text/javascript "access plus 1 day" | |
ExpiresByType application/javascript "access plus 1 day" | |
ExpiresByType application/x-javascript "access plus 1 day" | |
<FilesMatch "\.(jpe?g|png|gif|js|css|woff)$"> | |
ExpiresDefault "access plus 1 day" | |
</FilesMatch> | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment