Skip to content

Instantly share code, notes, and snippets.

View evemilano's full-sized avatar

Giovanni Sacheli evemilano

View GitHub Profile
@evemilano
evemilano / Abilitare GZIP su Apache via HTACCESS
Created May 24, 2014 19:18
Abilitare GZIP su Apache via HTACCESS
# compress text, HTML, JavaScript, CSS, and XML
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
@evemilano
evemilano / Abilitare GZIP su Apache via HTACCESS - II Metodo
Created May 24, 2014 19:47
Abilitare GZIP su Apache via HTACCESS - II Metodo
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
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>
@evemilano
evemilano / Abilitare GZIP su NGINX via HTACCESS
Created May 24, 2014 19:48
Abilitare GZIP su NGINX via HTACCESS
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
@evemilano
evemilano / Abilitare il Browser Caching via .HTACCESS
Created May 24, 2014 19:50
Abilitare il Browser Caching via .HTACCESS
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@evemilano
evemilano / Come allineare i pulsanti Social
Last active August 29, 2015 14:01
Come allineare i pulsanti Social
<div style="float:left;">
<! Facebook !>
<div id="fb-root"></div>
<div class="fb-like" data-layout="box_count" data-action="like" data-show-faces="false" data-share="false"></div>
</div>
<div style="float:left;">
<! Google !>
<div class="g-plusone" data-size="tall"></div>
@evemilano
evemilano / Escludere codice da WordPress se utente loggato
Created May 24, 2014 20:03
Escludere codice da WordPress se utente loggato
<?php if (!is_user_logged_in()) { ?>
Inserisci qui il tuo codice di Google Analytics
<?php } ?>
@evemilano
evemilano / Rel alternate mobile tag for Sitemap.xml
Last active August 29, 2015 14:03
Rel alternate mobile tag for Sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>http://www.example.com/page-1/</loc>
<xhtml:link
rel="alternate"
media="only screen and (max-width: 640px)"
href="http://m.example.com/page-1" />
</url>
@evemilano
evemilano / Redirezionare tutte le richieste al dominio senza ‘www’
Created December 17, 2014 22:36
Redirezionare tutte le richieste al dominio senza ‘www’
RewriteEngine on
# Redirect to domain without www.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule .* http://%1%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]
@evemilano
evemilano / Noindex Post if category Y
Created December 17, 2014 22:28
Taggare NOINDEX categorie di WordPress
<?php if (is_single() && in_category(array(###))) { echo '<meta name="robots" content="noindex, follow">'; } ?>
function rimuovi_campo_url($fields) {
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields','rimuovi_campo_url');