lrc/silverstripe-boilerplate/master/.htaccess - Htaccess File

lrc/silverstripe-boilerplate/master/.htaccess

RewriteEngine On

## Permanent redirects to avoid duplicate stats entries
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_URI} !^/(admin|Security)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_METHOD} GET
RewriteRule  ^(.+[^/])$  /$1/  [L,R=301]

<Files *.ini>
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Files>

## Speed this gear up
<IfModule mod_headers.c>
  Header set Cache-Control "public"
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/text
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript 
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
 
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 3 days"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/x-icon "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 604800 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
</IfModule>

### SILVERSTRIPE START ###
<Files *.ss>
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Files>

<Files web.config>
  Order deny,allow
  Deny from all
</Files>

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_alias.c>
  RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule>

<IfModule mod_rewrite.c>
  SetEnv HTTP_MOD_REWRITE On
  RewriteEngine On

  RewriteCond %{REQUEST_URI} ^(.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule .* framework/main.php?url=%1 [QSA]

  RewriteCond %{REQUEST_URI} ^(.*)/framework/main.php$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule . %1/install.php? [R,L]

</IfModule>
### SILVERSTRIPE END ###

On Github License

Files

Download PDF of Htaccess file
DEFLATE, GET, REQUEST_FILENAME, REQUEST_METHOD, REQUEST_URI

Comments

Apache