jackfiallos/celestic-v2/master/web/.htaccess - Htaccess File

jackfiallos/celestic-v2/master/web/.htaccess

# sudo a2enmod rewrite deflate headers

######################################
# Global PHP and Apache Configuration
######################################

ContentDigest On

# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0

php_flag display_errors Off
php_flag expose_php Off
php_value register_globals Off
ServerSignature Off
DefaultLanguage es-MX

##################
# UTF-8 encoding
##################

AddDefaultCharset utf-8

###############################################
# SSL if needed, friendly URLs and www removed
###############################################

<IfModule mod_rewrite.c>
  # enable symbolic links
  Options +FollowSymLinks
  #Options All -Indexes
  Options -Indexes
  IndexIgnore */*
  RewriteEngine on

  # accept connection only using https
  #RewriteCond %{HTTPS} !=on
  #RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

  # if a directory or a file exists, use it directly
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  # otherwise forward it to index.php
  RewriteRule . index.php

  # Denies POST requests by blank user-agents. May prevent a small number of visitors from POSTING
  RewriteCond %{REQUEST_METHOD} =POST
  RewriteCond %{HTTP_USER_AGENT} ^-?$
  RewriteCond %{REQUEST_URI} !^/(/).* [NC]
  RewriteRule .* - [F,NS,L]

  # Disable easter egg php
  RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]
  RewriteRule .* - [F]

</IfModule>

###########
# Security
###########

# secure htaccess file
<files .htaccess>
  #order allow,deny
  #deny from all
  Require all denied
</files>

###################
# Cache and compresion
###################

<ifModule mod_php5.c>
  php_value zlib.output_compression 16386
</ifModule>

<ifModule mod_gzip.c>
  <IfModule mod_headers.c>
    Header add X-Enabled mod_gzip
  </IfModule>
</ifModule>

<IfModule mod_deflate.c>
  <FilesMatch ".(js|css)$">
    SetOutputFilter DEFLATE
  </FilesMatch>

  Header add x-enabled mod_deflate

  <IfModule mod_headers.c>
    Header append Vary User-Agent
  </IfModule>
</IfModule>

<IfModule mod_headers.c>
  Header add x-content-type-options "nosniff"
  Header add x-frame-options "SAMEORIGIN"
  Header add x-xss-protection: "1; mode=block"
  Header add X-Pingback: http://qompit.com/ping
</ifModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, HTTP_USER_AGENT, HTTPS, ORIGIN, POST, QUERY_STRING, REQUEST_FILENAME, REQUEST_METHOD, REQUEST_URI, SERVER_NAME

Comments

Apache