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

jackfiallos/celestic-v2/master/.htaccess

# En linux el servidor debe de tener activado los siguientes modulos
# sudo a2enmod modulo
# rewrite mem_cache cache headers expires
# expose_php Off to show off php configuration
# SET GLOBAL query_cache_size = 16777216;
# SHOW VARIABLES LIKE 'query_cache_size';
# You can setup them in /etc/my.cnf (Red Hat) or /etc/mysql/my.cnf (Debian) file:
# vi /etc/my.cnf
# query_cache_size = 268435456
# query_cache_type=1
# query_cache_limit=1048576

php_value register_globals off
#expose_php Off
Header add x-content-type-options "nosniff"
Header add x-frame-options "SAMEORIGIN"
Header add x-xss-protection: "1; mode=block"

ContentDigest On

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

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

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

  RewriteCond %{THE_REQUEST} ^GET /.*;.* HTTP/
  RewriteCond %{QUERY_STRING} !^$
  RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI}? [R=301,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

  #External Redirect .php files to .html files (SEO friendly)
  #RewriteRule ^(.*).php$ /$1.html [R=301,L]

  RewriteRule ^(.*).html$ $1.php [R=301,L]
</IfModule>

#############################################

SetEnv SERVER_ADMIN info@qbit.com.mx
SetEnv TZ America/Mexico_City
ServerSignature Off

# enable symbolic links
Options +FollowSymLinks

# set the default language
DefaultLanguage es-MX

# set the default character set
<Files ~ ".(htm|html|css|js|php)$">
  AddDefaultCharset UTF-8
  DefaultLanguage en-US
</Files>

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

# preserve bandwidth for PHP enabled servers
<ifmodule mod_php4.c>
  php_value zlib.output_compression 16386
</ifmodule>

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

# prevent acess to multiple file types
<FilesMatch ".(htaccess|ini|log|sh)$">
  Order Allow,Deny
  Deny from all
</FilesMatch>

# headers caching
<ifModule mod_headers.c>
  Header set Content-Language "en-US"
  <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|css)$">
    Header set Cache-Control "max-age=29030400, public"
  </filesMatch>
  <filesMatch "\.(js)$">
    Header set Cache-Control "max-age=29030400, private"
  </filesMatch>
  <filesMatch "\.(xml|txt)$">
    Header set Cache-Control "max-age=29030400, public, must-revalidate"
  </filesMatch>
  <filesMatch "\.(html|htm)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
  </filesMatch>
</ifModule>

# Force no caching for dynamic files
<FilesMatch ".(php|cgi|pl|htm)$">
  FileETag None
  ExpiresActive Off
  <IfModule mod_headers.c>
    Header unset ETag
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
    Header set Pragma "no-cache"
  </IfModule>
#  order allow,deny
#  deny from 127.0.0.
#  deny from isp_name.com
#  allor from all
</FilesMatch>

<FilesMatch ".(html|htm|css|js|php|jpg|png|gif|ico)$">
  FileETag None
  <IfModule mod_headers.c>
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </IfModule>
</FilesMatch>

<FilesMatch ".(ico|jpg|jpeg|png|gif|js|css)$">
  <IfModule mod_headers.c>
    Header set Cache-Control "max-age=29030400, public"
    Header set Expires "Mon, 31 Dic 2012 20:00:00 GMT"
  </IfModule>
</FilesMatch>

<FilesMatch ".(ico|jpg|jpeg|png|gif|js|css)$">
  <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 year"
  </IfModule>
</FilesMatch>

<ifModule mod_gzip.c>
  Header add X-Enabled mod_gzip  
  
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|css|js|php|jpg|png|gif|ico)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<IfModule mod_deflate.c>
  <FilesMatch ".(js|css)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
  
  Header add x-enabled mod_deflate  
  
  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 mod_headers.c>
    Header append Vary User-Agent
  </IfModule>
  
</IfModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, GET, HTTPS, no-cache, ORIGIN, Pragma, QUERY_STRING, REQUEST_FILENAME, REQUEST_URI, SERVER_ADMIN, SERVER_NAME, THE_REQUEST, TZ

Comments

Apache