directionalconsulting/eleganterrors/master/.htaccess - Htaccess File

directionalconsulting/eleganterrors/master/.htaccess

# Set our base environment variable for the /errors/msg.php?c= directive
<IfModule mod_env.c>
  SetEnv EE_DIR /errors/
</IfModule>

# Override Error Handling and make it clear in logs and to visitors
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^errors/lib/ - [F,L]
  RewriteRule ^errors/support$ /errors/msg.php [L]
  RewriteRule ^errors/thank-you$ /errors/msg.php [L]
  RewriteRule ^errors/credits$ /errors/msg.php [L]
  RewriteCond %{ENV:REDIRECT_STATUS} =505
  RewriteRule ^$ /errors/msg.php?c=505 [L]
  RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^errors/(.*?)$ /errors/msg.php [L]
</IfModule>

##
# @TODO - FixMe :: NOT WORKING - not even certain if this is correct, comments please...
# Redirect 3xx and Non-standard XXX codes class handler...
<IfModule mod_alias.c>
  Redirect 007 /errors/msg.php?c=007
  Redirect 042 /errors/msg.php?c=042
  Redirect 069 /errors/msg.php?c=069
#  RedirectPermanent 301 /errors/msg.php?c=301
#  RedirectTemp 302 /errors/msg.php?c=302
#  Redirect 303 /errors/msg.php?c=303
#  Redirect 304 /errors/msg.php?c=304
#  Redirect 305 /errors/msg.php?c=305
#  Redirect 306 /errors/msg.php?c=306
#  RedirectTemp 307 /errors/msg.php?c=307
  Redirect 418 /errors/msg.php?c=418
  Redirect 420 /errors/msg.php?c=420
  Redirect 431 /errors/msg.php?c=431
  Redirect 449 /errors/msg.php?c=449
  Redirect 451 /errors/msg.php?c=451
  Redirect 511 /errors/msg.php?c=511
</IfModule>

<IfModule mod_dir.c>
  # Default DirectoryIndex files
  DirectoryIndex index.php index.shtml index.html
  Order allow,deny
  Allow from all
</IfModule>

##
# Options and ErrorDocument are part of mod_core.c so no need for an IfModule block
##
Options -Indexes +FollowSymLinks +ExecCGI

#ErrorDocument 042 /errors/msg.php?c=042
#ErrorDocument 069 /errors/msg.php?c=069
ErrorDocument 400 /errors/msg.php?c=400
ErrorDocument 401 /errors/msg.php?c=401
ErrorDocument 402 /errors/msg.php?c=402
ErrorDocument 403 /errors/msg.php?c=403
ErrorDocument 404 /errors/msg.php?c=404
ErrorDocument 405 /errors/msg.php?c=405
ErrorDocument 406 /errors/msg.php?c=406
ErrorDocument 407 /errors/msg.php?c=407
ErrorDocument 408 /errors/msg.php?c=408
ErrorDocument 409 /errors/msg.php?c=409
ErrorDocument 410 /errors/msg.php?c=410
ErrorDocument 411 /errors/msg.php?c=411
ErrorDocument 412 /errors/msg.php?c=412
ErrorDocument 413 /errors/msg.php?c=413
ErrorDocument 414 /errors/msg.php?c=414
ErrorDocument 415 /errors/msg.php?c=415
ErrorDocument 416 /errors/msg.php?c=416
ErrorDocument 417 /errors/msg.php?c=417
#ErrorDocument 418 /errors/msg.php?c=418
#ErrorDocument 420 /errors/msg.php?c=420
ErrorDocument 422 /errors/msg.php?c=422
ErrorDocument 423 /errors/msg.php?c=423
ErrorDocument 424 /errors/msg.php?c=424
ErrorDocument 426 /errors/msg.php?c=426
#ErrorDocument 431 /errors/msg.php?c=431
#ErrorDocument 449 /errors/msg.php?c=449
#ErrorDocument 451 /errors/msg.php?c=451
ErrorDocument 500 /errors/msg.php?c=500
ErrorDocument 501 /errors/msg.php?c=501
ErrorDocument 503 /errors/msg.php?c=503
ErrorDocument 504 /errors/msg.php?c=504
ErrorDocument 507 /errors/msg.php?c=507
ErrorDocument 506 /errors/msg.php?c=506
ErrorDocument 508 /errors/msg.php?c=508
#ErrorDocument 511 /errors/msg.php?c=511

<IfModule mod_mime.c>

  # Text
  AddType text/css .css
  AddType application/x-javascript .js
  AddType text/html .html .htm
  AddType text/richtext .rtf .rtx
  AddType text/plain .txt
  AddType text/xml .xml

  # Image
  AddType image/gif .gif
  AddType image/x-icon .ico
  AddType image/jpeg .jpg .jpeg .jpe
  AddType image/png .png
  AddType image/svg+xml .svg .svgz

  # Video
  AddType video/asf .asf .asx .wax .wmv .wmx
  AddType video/avi .avi
  AddType video/quicktime .mov .qt
  AddType video/mp4 .mp4 .m4v
  AddType video/mpeg .mpeg .mpg .mpe

  # PDF
  AddType application/pdf .pdf

  # Flash
  AddType application/x-shockwave-flash .swf

  # Font
  AddType application/x-font-ttf .ttf .ttc
  AddType application/vnd.ms-fontobject .eot
  AddType application/x-font-otf .otf

  # Audio
  AddType audio/mpeg .mp3 .m4a
  AddType audio/ogg .ogg
  AddType audio/wav .wav
  AddType audio/wma .wma

  # Zip/Tar
  AddType application/x-tar .tar
  AddType application/x-gzip .gz .gzip
  AddType application/zip .zip
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive On

  # Text
  ExpiresByType text/css A31536000
  ExpiresByType application/x-javascript A31536000
  ExpiresByType text/html A3600
  ExpiresByType text/richtext A3600
  ExpiresByType text/plain A3600
  ExpiresByType text/xml A3600

  # Image
  ExpiresByType image/gif A31536000
  ExpiresByType image/x-icon A31536000
  ExpiresByType image/jpeg A31536000
  ExpiresByType image/png A31536000
  ExpiresByType image/svg+xml A31536000

  # Video
  ExpiresByType video/asf A31536000
  ExpiresByType video/avi A31536000
  ExpiresByType video/quicktime A31536000
  ExpiresByType video/mp4 A31536000
  ExpiresByType video/mpeg A31536000

  # PDF
  ExpiresByType application/pdf A31536000

  # Flash
  ExpiresByType application/x-shockwave-flash A31536000

  # Font
  ExpiresByType application/x-font-ttf A31536000
  ExpiresByType application/vnd.ms-fontobject A31536000
  ExpiresByType application/x-font-otf A31536000

  # Audio
  ExpiresByType audio/mpeg A31536000
  ExpiresByType audio/ogg A31536000
  ExpiresByType audio/wav A31536000
  ExpiresByType audio/wma A31536000

  # Zip/Tar
  ExpiresByType application/x-tar A31536000
  ExpiresByType application/x-gzip A31536000
  ExpiresByType application/zip A31536000
</IfModule>
<FilesMatch ".(?i:css|js|htm|html|rtf|rtx|txt|xml|gif|ico|jpg|jpeg|jpe|png|svg|svgz|asf|asx|wax|wmv|wmx|avi|mov|qt|mp4|m4v|mpeg|mpg|mpe|pdf|swf|ttf|ttc|eot|otf|mp3|m4a|ogg|wav|wma|tar|gz|gzip|zip)$">
  <IfModule mod_headers.c>
    Header set Pragma "public"
    Header append Cache-Control "public, must-revalidate, proxy-revalidate"
    Header unset ETag
  </IfModule>
</FilesMatch>
<FilesMatch ".(?i:css|js|gif|ico|jpg|jpeg|jpe|png|pdf|swf|ttf|ttc|eot|otf)$">
    <IfModule mod_headers.c>
    Header unset Set-Cookie
  </IfModule>
</FilesMatch>

<IfModule mod_deflate.c>
  # Compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

# PHP Options
<IfModule mod_php5.c>
  php_flag allow_url_include off
  php_flag allow_url_fopen off
  php_flag register_globals off
  php_flag short_open_tag on
  php_flag display_errors on
  php_flag html_errors on
  php_flag log_errors on
  php_value error_log "errors/php_error.log"
#  php_flag ignore_repeated_errors on
#  php_flag ignore_repeated_source on
#  php_value error_reporting "E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT"
#  php_value error_reporting "E_WARNING & E_ERROR"
  php_value error_reporting "E_ALL"
  php_value memory_limit 256M
#  php_flag expose_php off
  php_flag cgi.force_redirect on
  php_flag session.auto_start off
  php_flag session.use_trans_sid off
  php_flag file_uploads on
  php_value max_post_size 32M
  php_value upload_max_filesize 256M
  php_value date.timezone "America/Los_Angeles"
  php_flag yaml.decode_php on
</IfModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, ENV, Pragma, REDIRECT_STATUS, REQUEST_FILENAME

Comments

Apache