Skip to content

Instantly share code, notes, and snippets.

@fitorec
Created September 14, 2012 14:44
Show Gist options
  • Save fitorec/3722337 to your computer and use it in GitHub Desktop.
Save fitorec/3722337 to your computer and use it in GitHub Desktop.

Revisions

  1. fitorec revised this gist Sep 14, 2012. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion .htaccess
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,6 @@ Options -Indexes
    # p.e. .htaccess, .htpasswd
    RedirectMatch 403 /\..*$

    # DENY BROWSER ACCESS TO THESE FILES
    # Denegando el acceso a archivos de configuracion de WP
    #
    # wp-config.php, bb-config.php, php.ini, php5.ini, readme.html
  2. fitorec revised this gist Sep 14, 2012. 1 changed file with 20 additions and 17 deletions.
    37 changes: 20 additions & 17 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    AddHandler x-httpd-php5 .php
    #########################################################################################
    # Wordpress Base #
    #########################################################################################
    #########################################################################
    # Wordpress Base #
    #########################################################################
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    @@ -10,30 +10,30 @@ AddHandler x-httpd-php5 .php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    ##########################################################################################
    # Configuraciones en general
    ##########################################################################################
    #########################################################################
    # Configuraciones en general #
    #########################################################################

    #Atrapando el error pagina no encontrada
    ErrorDocument 404 /404.php

    #########################################################################################
    # Cache Control #
    #########################################################################################
    #########################################################################
    # Cache Control #
    #########################################################################

    #Agregando cache a algunos archivos
    <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
    Header set Cache-Control "max-age=2592000"
    </FilesMatch>

    # Eliminando el cache en otros archivos que se requieren sean actualizados.
    # Quitando cache en archivos que se requieren sean actualizados.
    <FilesMatch ".(pl|php|json|xml)$">
    Header unset Cache-Control
    </FilesMatch>

    #########################################################################################
    # CUESTIONES DE SEGUIRIDAD #
    #########################################################################################
    #########################################################################
    # CUESTIONES DE SEGUIRIDAD #
    #########################################################################
    #Quitando todo seguimiento a los archivos SQL
    <FilesMatch ".(htaccess|htpasswd|sql)$">
    Order Allow,Deny
    @@ -42,7 +42,7 @@ ErrorDocument 404 /404.php

    # Forzando directorio indice a index.php
    #
    # De existir index.html sera ignorado y se mostrando el index.php
    # De existir index.html sera ignorado
    DirectoryIndex index.php index.html /index.php

    # Quitando el listado de directorios
    @@ -56,9 +56,10 @@ RedirectMatch 403 /\..*$
    # Denegando el acceso a archivos de configuracion de WP
    #
    # wp-config.php, bb-config.php, php.ini, php5.ini, readme.html
    # Remplaza "Allow from <TU-IP>" cambiando 88.77.66.55 por tu IP actual
    # y descomenta las lineas(quita el #), para poder acceder a estos
    # recursos desde tu navegador:
    # Remplaza "Allow from <TU-IP>" cambiando 88.77.66.55 por tu
    # IP actual y descomenta las lineas(quita el #), para poder
    # acceder a estos recursos desde tu navegador:
    #
    #<FilesMatch "^(wp-config\.php|php\.ini|php5\.ini|readme\.html|bb-config\.php)">
    # Order allow,deny
    # Deny from all
    @@ -68,6 +69,7 @@ RedirectMatch 403 /\..*$
    # Quitando seguimiento a algunos archivos de los robots
    # Info: http://davidwalsh.name/prevent-robot-index
    # Descomenta las lineas para activar este comportamiento.
    #
    #<Files ~ "\.pdf$">
    # Header set X-Robots-Tag "noindex"
    #</Files>
    @@ -77,6 +79,7 @@ RedirectMatch 403 /\..*$
    # Es necesario que remplaces "agrega-tu-dominio" para bloquear
    # el acceso a imagenes insertadas en otros sitios
    # Info: http://altlab.com/htaccess_tutorial.html
    #
    #RewriteEngine On
    #RewriteCond %{HTTP_REFERER} !^https?://(www\.)?agrega-tu-dominio\.com [NC]
    #RewriteCond %{HTTP_REFERER} !^$
  3. fitorec created this gist Sep 14, 2012.
    83 changes: 83 additions & 0 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,83 @@
    AddHandler x-httpd-php5 .php
    #########################################################################################
    # Wordpress Base #
    #########################################################################################
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    ##########################################################################################
    # Configuraciones en general
    ##########################################################################################

    #Atrapando el error pagina no encontrada
    ErrorDocument 404 /404.php

    #########################################################################################
    # Cache Control #
    #########################################################################################

    #Agregando cache a algunos archivos
    <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
    Header set Cache-Control "max-age=2592000"
    </FilesMatch>

    # Eliminando el cache en otros archivos que se requieren sean actualizados.
    <FilesMatch ".(pl|php|json|xml)$">
    Header unset Cache-Control
    </FilesMatch>

    #########################################################################################
    # CUESTIONES DE SEGUIRIDAD #
    #########################################################################################
    #Quitando todo seguimiento a los archivos SQL
    <FilesMatch ".(htaccess|htpasswd|sql)$">
    Order Allow,Deny
    Deny from all
    </FilesMatch>

    # Forzando directorio indice a index.php
    #
    # De existir index.html sera ignorado y se mostrando el index.php
    DirectoryIndex index.php index.html /index.php

    # Quitando el listado de directorios
    Options -Indexes

    # Denegando el acceso a archivos de configuracion
    # p.e. .htaccess, .htpasswd
    RedirectMatch 403 /\..*$

    # DENY BROWSER ACCESS TO THESE FILES
    # Denegando el acceso a archivos de configuracion de WP
    #
    # wp-config.php, bb-config.php, php.ini, php5.ini, readme.html
    # Remplaza "Allow from <TU-IP>" cambiando 88.77.66.55 por tu IP actual
    # y descomenta las lineas(quita el #), para poder acceder a estos
    # recursos desde tu navegador:
    #<FilesMatch "^(wp-config\.php|php\.ini|php5\.ini|readme\.html|bb-config\.php)">
    # Order allow,deny
    # Deny from all
    # Allow from 88.77.66.55
    #</FilesMatch>

    # Quitando seguimiento a algunos archivos de los robots
    # Info: http://davidwalsh.name/prevent-robot-index
    # Descomenta las lineas para activar este comportamiento.
    #<Files ~ "\.pdf$">
    # Header set X-Robots-Tag "noindex"
    #</Files>

    # Bloqueamos el hotlinking de imagenes
    #
    # Es necesario que remplaces "agrega-tu-dominio" para bloquear
    # el acceso a imagenes insertadas en otros sitios
    # Info: http://altlab.com/htaccess_tutorial.html
    #RewriteEngine On
    #RewriteCond %{HTTP_REFERER} !^https?://(www\.)?agrega-tu-dominio\.com [NC]
    #RewriteCond %{HTTP_REFERER} !^$
    #RewriteRule .*\.(jpeg|jpg|gif|bmp|png)$ - [F]