jasonclark/search-ux/master/.htaccess - Htaccess File

jasonclark/search-ux/master/.htaccess

#add handler that allows html to work dynamically as PHP
#https://httpd.apache.org/docs/current/mod/mod_mime.html#addtype
#https://httpd.apache.org/docs/current/mod/mod_mime.html#addhandler
#AddType application/x-httpd-php .html .xml .json
AddHandler php5-script .html

#serve all resources labeled as 'text/html' or 'text/plain' with the media type 'charset' parameter set to UTF-8'
#https://httpd.apache.org/docs/current/mod/core.html#adddefaultcharset
AddDefaultCharset utf-8

#compress html, css, javascript, font, and miscellaneous resources
#https://httpd.apache.org/docs/current/mod/mod_deflate.html
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE "text/css" "text/html" "text/javascript" "text/plain" "text/xml" "application/x-javascript" "application/javascript" "application/json" "application/ld+json" "application/rdf+xml" "application/rss+xml" "application/x-font-woff" "application/x-font-ttf" "application/vnd.ms-fontobject" "font/eot" "font/opentype" "font/otf" "font/ttf" "font/x-woff" "image/bmp" "image/jpeg" "image/svg+xml" "image/vnd.microsoft.icon" "image/x-icon" 
</IfModule>

#rewrite rules for URLs and directory patterns
#https://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteEngine
#https://httpd.apache.org/docs/current/mod/core.html#options
#https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
#https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions
<IfModule mod_rewrite.c>
  #Options +FollowSymLinks
  #Options +SymLinksIfOwnerMatch
  RewriteEngine On

  #check for 200 header, legitimate url 
  RewriteCond %{ENV:REDIRECT_STATUS} 200
  RewriteRule .* - [L]

  #remove need to have .html extension in filename
  RewriteCond %{REQUEST_FILENAME}.html -f
  RewriteRule ^(.*)$ $1.html [NC,L,QSA]
</IfModule>

On Github License

Files

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

Comments

Apache