Skip to content

Instantly share code, notes, and snippets.

@internoma
Created January 6, 2013 21:56
Show Gist options
  • Save internoma/4470526 to your computer and use it in GitHub Desktop.
Save internoma/4470526 to your computer and use it in GitHub Desktop.
HTACCESS: zincarquitectos.com
# HTACCESS: Alfredo González P.
# Configuración avanzada
# Advanced settings
# Añadir soporte para imágenes svg
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Cache de archivos
<IfModule mod_headers.c>
# 1 YEAR
<FilesMatch ".(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch ".(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS
<FilesMatch ".(xml|txt|css|js)$">
Header set Cache-Control "max-age=172800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch ".(html|htm|php)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>
</IfModule>
# Reducir las páginas comprimiendo datos
# Reduce pages weight by compressing static data
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# Elimina la extensión de los archivos en la URL
# Remove file extensions from urls
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
# Reemplzar con la extensión, ejem: php, htm, asp
# Replace html with your file extension, eg: php, htm, asp
# Redirigir hacia www
# Redirect www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^zincarquitectos.com [NC]
RewriteRule ^(.*)$ http://www.zincarquitectos.com/$1 [L,R=301]
# ----------------------------------------------------------------------
# Seguridad desde htaccess
# ----------------------------------------------------------------------
# Previene el listado de las carpetas
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# Bloquea el acceso a carpetas ocultas o archivos que su nombre comienza
# con un guión (-archivo). Estas carpetas son utilizadas por sistemas de control
# de versiones como Subversion o Git.
<IfModule mod_rewrite.c>
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]
</IfModule>
# Bloquea el acceso a backup y ficheros fuente. Estos ficheros puede ser editados
# y suponer un problema de seguridad.
<FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
# Incrementar la seguridad de las cookies
<IfModule mod_php5.c>
php_value session.cookie_httponly true
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment