StichtingL3D/tools.l3d.nl/master/public_html/.htaccess - Htaccess File

StichtingL3D/tools.l3d.nl/master/public_html/.htaccess

# ------------------------------------------------------------------------------
# errors and security
# ------------------------------------------------------------------------------
php_flag display_startup_errors On
php_flag display_errors On
php_flag register_globals Off
php_flag magic_quotes_gpc Off
php_value post_max_size 10M
php_value upload_max_filesize 5M
Options -Indexes

# ------------------------------------------------------------------------------
# use, and force, utf-8 encoding
# ------------------------------------------------------------------------------
AddDefaultCharset UTF-8
AddCharset utf-8 .html .css .js .xml .json .rss .atom

# ------------------------------------------------------------------------------
# mime types
# ------------------------------------------------------------------------------
AddType image/x-icon ico
AddType application/javascript js
AddType font/opentype otf
AddType application/x-font-ttf ttf ttc
AddType application/x-font-woff woff
AddType application/vnd.ms-fontobject eot
AddType image/svg+xml svg svgz
AddType text/x-vcard vcf
AddType application/zip zip
AddEncoding gzip svgz

# ------------------------------------------------------------------------------
# expire
# ------------------------------------------------------------------------------
<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType text/html      "access plus 0 seconds"
  ExpiresByType application/atom+xml  "access plus 1 hour"
  ExpiresByType image/x-icon   "access plus 1 week"
  ExpiresByType image/gif      "access plus 1 month"
  ExpiresByType image/jpg      "access plus 1 month"
  ExpiresByType image/jpeg     "access plus 1 month"
  ExpiresByType image/png      "access plus 1 month"
  ExpiresByType font/truetype  "access plus 1 month"
  ExpiresByType font/opentype  "access plus 1 month"
  ExpiresByType image/svg+xml  "access plus 1 month"
  ExpiresByType application/x-font-woff  "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject  "access plus 1 month"
  ExpiresByType application/zip "access plus 1 month"
  ExpiresByType text/css       "access plus 1 year"
  ExpiresByType application/javascript  "access plus 1 year"
  #ExpiresByType text/xml       "access plus 1 hour"
  #ExpiresByType video/ogg      "access plus 1 month"
  #ExpiresByType video/mp4      "access plus 1 month"
  #ExpiresByType video/webm     "access plus 1 month"
  <IfModule mod_headers.c>
    Header append Cache-Control "public"
  </IfModule>
</IfModule>
FileETag None

# ------------------------------------------------------------------------------
# compress html/js/css resources
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
  SetOutputFilter DEFLATE
  SetEnvIfNoCase Request_URI .(?:png|jpe?g|gif|ico)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI .(?:eot|svg|ttf|woff)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI .(?:pdf|zip)$ no-gzip dont-vary
</IfModule>

# ------------------------------------------------------------------------------
# start redirection, use /-only rewritebase on production
# ------------------------------------------------------------------------------
<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteBase /
  
  # ------------------------------------------------------------------------------
  # blocking certain users
  # ------------------------------------------------------------------------------
  
    # ------------------------------------------------------------------------------
    # block access to . folders like git
    # ------------------------------------------------------------------------------
    RewriteRule "(^|/)." - [F]
    
    # ------------------------------------------------------------------------------
    # empty user agents
    # java scripters: http://serverfault.com/questions/308210/the-java-1-4-1-04-user-agent-clashes-404-with-some-jquery-javascript
    # ------------------------------------------------------------------------------
    RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
    RewriteCond %{HTTP_USER_AGENT} Java.*
    RewriteRule ^.* - [F]
  
  # ------------------------------------------------------------------------------
  # only serve on www
  # first condition excludes localhost
  # ------------------------------------------------------------------------------
  #RewriteCond %{HTTP_HOST} .
  #RewriteCond %{HTTP_HOST} !^www.
  #RewriteCond %{HTTP_HOST} !^dev.
  #RewriteCond %{HTTP_HOST} !^test.
  #RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  
  # ------------------------------------------------------------------------------
  # content redirects
  # ------------------------------------------------------------------------------
  
  # ------------------------------------------------------------------------------
  # timestamp static resources
  # ------------------------------------------------------------------------------
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+).(d+).(css|js|gif|jpg|jpeg|png)$ $1.$3 [L]
  
  # ------------------------------------------------------------------------------
  # maintenance modus
  # ------------------------------------------------------------------------------
  RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
  RewriteCond %{REQUEST_URI} !.css$
  RewriteCond %{REQUEST_URI} !.js$
  RewriteCond %{REQUEST_URI} !.gif$
  RewriteCond %{REQUEST_URI} !.jpg$
  RewriteCond %{REQUEST_URI} !.jpeg$
  RewriteCond %{REQUEST_URI} !.png$
  RewriteCond %{REQUEST_URI} !.ico$
  RewriteCond %{REMOTE_HOST} !^127.0.0.1
  RewriteCond %{REMOTE_HOST} !^82.161.139.66
  RewriteRule $ maintenance.html [L]
  
  # ------------------------------------------------------------------------------
  # remove the traling slash
  # ------------------------------------------------------------------------------
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)/$ $1 [R=301,L]
  
  # ------------------------------------------------------------------------------
  # nicer uris
  # "/$1" to fill the PATH_INFO (optional, see index)
  # ------------------------------------------------------------------------------
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]

# ------------------------------------------------------------------------------
# end redirection
# ------------------------------------------------------------------------------
</IfModule>

# ------------------------------------------------------------------------------
# custom error handling
# TODO: 408, 504 is timeout, can retry without modifications
# TODO: 503 is overload, can retry without modifications
# ------------------------------------------------------------------------------
ErrorDocument 400 /error404.php
ErrorDocument 401 /error404.php
ErrorDocument 403 /error404.php
ErrorDocument 404 /error404.php
ErrorDocument 406 /error404.php
ErrorDocument 407 /error404.php
ErrorDocument 408 /error404.php
ErrorDocument 409 /error404.php
ErrorDocument 410 /error404.php
ErrorDocument 411 /error404.php
ErrorDocument 412 /error404.php
ErrorDocument 413 /error404.php
ErrorDocument 414 /error404.php
ErrorDocument 415 /error404.php
ErrorDocument 416 /error404.php
ErrorDocument 417 /error404.php
ErrorDocument 501 /error404.php
ErrorDocument 505 /error404.php

ErrorDocument 500 /error500.php
ErrorDocument 502 /error500.php
ErrorDocument 503 /error500.php
ErrorDocument 504 /error500.php

# ------------------------------------------------------------------------------
# default entrance
# ------------------------------------------------------------------------------
DirectoryIndex index.php

On Github License

Files

Download PDF of Htaccess file
DEFLATE, DOCUMENT_ROOT, HTTP_HOST, HTTP_USER_AGENT, no-gzip, PATH_INFO, REMOTE_HOST, REQUEST_FILENAME, REQUEST_URI, static

Comments

Apache