mlaville/px-layout/master/acces/.htaccess - Htaccess File


# ------------------------------------------------------------------------------------------------------------------------
# This is a comment that will be ignored by the server, note the # at the start of the line to indicate this.
# This is an example file, and will need to be adjusted to suit your needs.
# You can delete segments or copy and paste .htaccess rule segments from the article here, using comments to let you know what's going on.
# ------------------------------------------------------------------------------------------------------------------------

# Error Pages (404-error.html can be called anything)
ErrorDocument 404 /404-error.html

# 301 Redirect of all http requests to a new domain (change newdomain to your domain name)
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !$ [NC]
RewriteRule ^(.*)$$1 [L,R=301] 

# Cache Certain file types, saves bandwidth and speeds up website

<FilesMatch ".(jpg|jpeg|png|gif|swf|css|js|ico|pdf|flv)$">
Header set Cache-Control "max-age=2629743, public"

# 2 DAYS
<FilesMatch ".(xml|txt|php|html)$">
Header set Cache-Control "max-age=172800, proxy-revalidate"

# Prevents Viewing of this file and poking around

# Disable directory listing from this point
Options -Indexes

# Prevent viewing of htaccess
<Files ~ "^.ht">
order allow,deny
deny from all
satisfy all

# Force all PDF files to download
# Requires Apaca Header Module - this will work for any file extensions you choose to put into the FilesMatch argument!

<FilesMatch ".(?i:pdf)$">
  ForceType application/octet-stream
  Header set Content-Disposition attachment

On Github License


Download PDF of Htaccess file