tdewolff/Dex/master/.htaccess - Htaccess File


Options -MultiViews
<IfModule mod_autoindex.c>
  Options -Indexes

<IfModule mod_rewrite.c>
  Options +SymLinksIfOwnerMatch

  # Rewrite URL section
  RewriteEngine on
  RewriteBase /

  # Omit www.
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
  RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

  # Trailing slash, except when it's a resource (has a dot)
  RewriteCond %{REQUEST_URI} !(/$|.)
  RewriteRule .* %{REQUEST_URI}/ [R=301,L]

  # Rewrite all to index.php
  # Condition 2 rewrites /base/test/ to (test/)#(/base/)test/
  # Which is backreferenced in the rule to ensure base dir is right
  RewriteCond %{REQUEST_URI} !(index.php)$
  RewriteCond $1#%{REQUEST_URI} ([^#]*)#(.*)1/*$
  RewriteRule ^(.*)$ %2index.php [QSA,L]

<IfModule mod_deflate.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)s*,?s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain text/x-component
    AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml image/x-icon
    AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
    AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json application/x-web-app-manifest+json
    AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
    AddOutputFilterByType DEFLATE font/truetype font/opentype

AddDefaultCharset UTF-8

<IfModule mod_mime.c>
  AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml

<IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)[0-9/]*$ no-gzip

<IfModule mod_headers.c>
  Header set X-UA-Compatible "IE=edge"
  # `mod_headers` can't match based on the content-type, however, we only
  # want to send this header for HTML pages and not for the other resources
  <FilesMatch ".(appcache|crx|css|cur|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|opus|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
    Header unset X-UA-Compatible

<IfModule mod_headers.c>
  Header unset ETag
  Header unset Pragma
  Header set Cache-Control "private, must-revalidate"

FileETag None

<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresDefault                                      "access plus 1 month"

  # CSS
  ExpiresByType text/css                              "access plus 1 year"

  # Data interchange
  ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/ld+json                   "access plus 0 seconds"
  ExpiresByType application/xml                       "access plus 0 seconds"
  ExpiresByType text/xml                              "access plus 0 seconds"

  # Favicon (cannot be renamed!) and cursor images
  ExpiresByType image/x-icon                          "access plus 1 week"

  # HTML components (HTCs)
  ExpiresByType text/x-component                      "access plus 1 month"

  # HTML
  ExpiresByType text/html                             "access plus 0 seconds"

  # JavaScript
  ExpiresByType application/javascript                "access plus 1 year"

  # Manifest files
  ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
  ExpiresByType text/cache-manifest                   "access plus 0 seconds"

  # Media
  ExpiresByType audio/ogg                             "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 video/mp4                             "access plus 1 month"
  ExpiresByType video/ogg                             "access plus 1 month"
  ExpiresByType video/webm                            "access plus 1 month"

  # Web feeds
  ExpiresByType application/atom+xml                  "access plus 1 hour"
  ExpiresByType application/rss+xml                   "access plus 1 hour"

  # Web fonts
  ExpiresByType application/font-woff                 "access plus 1 month"
  ExpiresByType application/         "access plus 1 month"
  ExpiresByType application/x-font-ttf                "access plus 1 month"
  ExpiresByType font/opentype                         "access plus 1 month"
  ExpiresByType image/svg+xml                         "access plus 1 month"

On Github License


Download PDF of Htaccess file