njorth/mathilde/master/.htaccess - Htaccess File

njorth/mathilde/master/.htaccess

# charset and language headers

AddDefaultCharset UTF-8
DefaultLanguage en-US

  # custom error documents

ErrorDocument 404 /404.html

  # gzip compression

SetOutputFilter DEFLATE

  # expire headers

ExpiresActive On
ExpiresDefault "access plus 1 week"

  <Filesmatch ".(html|php)$">
ExpiresDefault "access plus 1 second"
  </Filesmatch>

  <Filesmatch ".(gif|ico|jpg|png)$">
ExpiresDefault "access plus 1 year"
  </Filesmatch>

  # rewrite engine

RewriteEngine on
RewriteBase /~njorth

  # rewrite any calls to *.html, *.json, *.xml, *.atom, *.rss, *.rdf or *.txt if a folder matching * exists

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{DOCUMENT_ROOT}/public/$1.$2 !-f
RewriteRule (.+).(html|json|xml|atom|rss|rdf|txt)$ $1/ [L]

  # add a trailing slash to directories

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ([^/]+)$ $1/ [L]

  # rewrite any calls to /* or /app to the index.php file

RewriteCond %{REQUEST_URI} /app/$
RewriteRule ^app/ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php?$1 [L]

  # rewrite any file calls to the public directory

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.+)$ public/$1 [L]

On Github License

Files

Download PDF of Htaccess file
DEFLATE, DOCUMENT_ROOT, REQUEST_FILENAME, REQUEST_URI

Comments

Apache