- Home
- Categorie
- Digital Marketing
- SEO
- .htaccess come si imposta e dove si mette?
-
.htaccess come si imposta e dove si mette?
Ciao a tutti, come spiegavo già nel mio post precedente (http://www.giorgiotave.it/forum/google/248906-2-domande-per-passare-da-standard-responsive-e-recuperare-posizioni.html) stò cercando di capire e sistemare i miei sitarelli, in questo caso nastri-trasportatori.net
Come per l'altro mio sito, mi affido all'analisi di pagespeed insights per cercare di migliorare e recuperare posizioni (accetto suggerimenti di ogni tipo e riguardo ad altri analizzatori), e anche in questo caso pagespeed insights mi dice "Sfrutta il caching del browser" "scadenza non specificata" ... per quello che avevo capito io, sarebbe bastato creare e immettere nel dominio un file .htaccess con le indicazioni di scadenza, cosa che ho fatto, ma al momento pagespeed insights continua a dirmi le stesse cose:
**Mi aiutereste a capire dove sbaglio e come correggermi?
***PS: oltre a questo *pagespeed insights mi dà altri suggerimenti che non riesco a capire/seguire: ho cercato nel forum se vi fosse una sorta di guida o tutorial esplicativo di come applicare i suggerimenti di pagespeed insights, ma non ho trovato nulla, avete qualcosa da segnalarmi o posso continuare a "rompere le scatole quì" compiendo un passo alla volta con una domanda alla volta?
-
Ciao, bisognerebbe vedere come hai impostato l' .htaccess; inoltre molti problemi li puoi risolvere utilizzando un plugin per la cache (ad esempio w3 total cache).
-
@PsYCHo said:
inoltre molti problemi li puoi risolvere utilizzando un plugin per la cache (ad esempio w3 total cache).
Ciao, dimenticavo di dire che sono un profano ... ho cercato W3 TOTAL CACHE ma pare essere una roba per wordpress, e poi non ho capito come si usa, potresti spiegarmi meglio?@PsYCHo said:
bisognerebbe vedere come hai impostato l' .htaccess
Ciao, in www.nastri-trasportatori.net il file .htaccess contiene:
(premetto che ho trovato il file .htaccess on line e che l'ho copia pari pari senza capirlo, per questo, oltre all'aiuto immediato chiedevo un aiuto per capire meglio come creare il file e dove metterlo ...)
INIZIO W3TC Browser Cache
<IfModule mod_mime.c>
AddType text/css .css
AddType application/javascript .js
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
AddType text/xsd .xsd
AddType text/xsl .xsl
AddType text/xml .xml
AddType video/asf .asf .asx .wax .wmv .wmx
AddType video/avi .avi
AddType image/bmp .bmp
AddType application/java .class
AddType video/divx .divx
AddType application/msword .doc .docx
AddType application/x-msdownload .exe
AddType image/gif .gif
AddType application/x-gzip .gz .gzip
AddType image/x-icon .ico
AddType image/jpeg .jpg .jpeg .jpe
AddType application/vnd.ms-access .mdb
AddType audio/midi .mid .midi
AddType video/quicktime .mov .qt
AddType audio/mpeg .mp3 .m4a
AddType video/mp4 .mp4 .m4v
AddType video/mpeg .mpeg .mpg .mpe
AddType application/vnd.ms-project .mpp
AddType application/vnd.oasis.opendocument.database .odb
AddType application/vnd.oasis.opendocument.chart .odc
AddType application/vnd.oasis.opendocument.formula .odf
AddType application/vnd.oasis.opendocument.graphics .odg
AddType application/vnd.oasis.opendocument.presentation .odp
AddType application/vnd.oasis.opendocument.spreadsheet .ods
AddType application/vnd.oasis.opendocument.text .odt
AddType audio/ogg .ogg
AddType application/pdf .pdf
AddType image/png .png
AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
AddType audio/x-realaudio .ra .ram
AddType application/x-shockwave-flash .swf
AddType application/x-tar .tar
AddType image/tiff .tif .tiff
AddType audio/wav .wav
AddType audio/wma .wma
AddType application/vnd.ms-write .wri
AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
AddType application/zip .zip
</IfModule>FINE W3TC Browser Cache
INIZIO E-Tag
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag NoneFINE E-Tag
INIZIO Nega accesso al file htaccess.
<Files .htaccess>
Order allow,deny
Deny from all
</Files>FINE Nega accesso al file htaccess.
INIZIO Nega accesso per il file config.php di vBulletin (SOLO PER VBULLETIN)
<Files includes/config.php>
Order allow,deny
Deny from all
</Files>FINE Nega accesso per il file config.php di vBulletin (SOLO PER VBULLETIN)
INIZIO Mime-Type
<IfModule mod_mime.c>
AddType text/css .css
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
AddType text/xsd .xsd
AddType text/xsl .xsl
AddType video/asf .asf .asx .wax .wmv .wmx
AddType video/avi .avi
AddType image/bmp .bmp
AddType application/java .class
AddType video/divx .divx
AddType application/msword .doc .docx
AddType application/x-msdownload .exe
AddType image/gif .gif
AddType application/x-gzip .gz .gzip
AddType image/x-icon .ico
AddType image/jpeg .jpg .jpeg .jpe
AddType application/vnd.ms-access .mdb
AddType audio/midi .mid .midi
AddType video/quicktime .mov .qt
AddType audio/mpeg .mp3 .m4a
AddType video/mp4 .mp4 .m4v
AddType video/mpeg .mpeg .mpg .mpe
AddType application/vnd.ms-project .mpp
AddType application/vnd.oasis.opendocument.database .odb
AddType application/vnd.oasis.opendocument.chart .odc
AddType application/vnd.oasis.opendocument.formula .odf
AddType application/vnd.oasis.opendocument.graphics .odg
AddType application/vnd.oasis.opendocument.presentation .odp
AddType application/vnd.oasis.opendocument.spreadsheet .ods
AddType application/vnd.oasis.opendocument.text .odt
AddType audio/ogg .ogg
AddType application/pdf .pdf
AddType image/png .png
AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
AddType audio/x-realaudio .ra .ram
AddType application/x-shockwave-flash .swf
AddType application/x-tar .tar
AddType image/tiff .tif .tiff
AddType audio/wav .wav
AddType audio/wma .wma
AddType application/vnd.ms-write .wri
AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
AddType application/zip .zip
</IfModule>FINE Mime-Type
INIZIO Expires Headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css A2628000
ExpiresByType text/richtext A3600
ExpiresByType image/svg+xml A3600
ExpiresByType text/plain A3600
ExpiresByType text/xsd A3600
ExpiresByType text/xsl A3600
ExpiresByType video/asf A2628000
ExpiresByType video/avi A2628000
ExpiresByType image/bmp A2628000
ExpiresByType application/java A2628000
ExpiresByType video/divx A2628000
ExpiresByType application/msword A2628000
ExpiresByType application/x-msdownload A2628000
ExpiresByType image/gif A2628000
ExpiresByType application/x-gzip A2628000
ExpiresByType image/x-icon A2628000
ExpiresByType image/jpeg A2628000
ExpiresByType application/vnd.ms-access A2628000
ExpiresByType audio/midi A2628000
ExpiresByType video/quicktime A2628000
ExpiresByType audio/mpeg A2628000
ExpiresByType video/mp4 A2628000
ExpiresByType video/mpeg A2628000
ExpiresByType application/javascript A2628000
ExpiresByType application/x-javascript A2628000
ExpiresByType application/vnd.ms-project A2628000
ExpiresByType application/vnd.oasis.opendocument.database A2628000
ExpiresByType application/vnd.oasis.opendocument.chart A2628000
ExpiresByType application/vnd.oasis.opendocument.formula A2628000
ExpiresByType application/vnd.oasis.opendocument.graphics A2628000
ExpiresByType application/vnd.oasis.opendocument.presentation A2628000
ExpiresByType application/vnd.oasis.opendocument.spreadsheet A2628000
ExpiresByType application/vnd.oasis.opendocument.text A2628000
ExpiresByType audio/ogg A2628000
ExpiresByType application/pdf A2628000
ExpiresByType image/png A2628000
ExpiresByType application/vnd.ms-powerpoint A2628000
ExpiresByType audio/x-realaudio A2628000
ExpiresByType application/x-shockwave-flash A2628000
ExpiresByType application/x-tar A2628000
ExpiresByType image/tiff A2628000
ExpiresByType audio/wav A2628000
ExpiresByType audio/wma A2628000
ExpiresByType application/vnd.ms-write A2628000
ExpiresByType application/vnd.ms-excel A2628000
ExpiresByType application/zip A2628000
</IfModule>FINE Expires Headers
INZIO Compressione file testo
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentyperimozione bug browser
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</ifModule>FINE Compressione file testo
INIZIO Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch ".(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=29030400, public"
</filesMatch>
<filesMatch ".(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch ".(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch ".(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>FINE Cache-Control Headers
Blocco per User-agent Libwww-perl
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* ? [F,L]proc/self/environ? no!
RewriteCond %{QUERY_STRING} proc/self/environ
Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D)
Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.(.)
Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C).script.(>|%3E) [NC,OR]
Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2})
Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
Commented version of Rewrite rules attributed to Ronald van den Heetkamp
Comments by http://bodvoc.com
Prevent use of specified methods in HTTP Request
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
Block out use of illegal or unsafe characters in the HTTP Request
RewriteCond %{THE_REQUEST} ^.(r|n|%0A|%0D). [NC,OR]
Block out use of illegal or unsafe characters in the Referer Variable of the HTTP Request
RewriteCond %{HTTP_REFERER} ^(.)(<|>|'|%0A|%0D|%27|%3C|%3E|%00). [NC,OR]
Block out use of illegal or unsafe characters in any cookie associated with the HTTP Request
RewriteCond %{HTTP_COOKIE} ^.(<|>|'|%0A|%0D|%27|%3C|%3E|%00). [NC,OR]
Block out use of illegal characters in URI or use of malformed URI
RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|">|"<|/|..).{0,9999}.* [NC,OR]
NOTE - disable this rule if your site is integrated with Payment Gateways such as PayPal
Block out use of empty User Agent Strings
RewriteCond %{HTTP_USER_AGENT} ^$
Block out use of User Agent Strings beginning with java, curl or wget
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
Block out use of User Agent Strings containing specific robot (crawler) identifiers
RewriteCond %{HTTP_USER_AGENT} ^.(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner). [NC,OR]
Block out use of User Agent Strings containing references to specific crawler libraries
RewriteCond %{HTTP_USER_AGENT} ^.(libwww-perl|curl|wget|python|nikto|scan). [NC,OR]
Block out use of illegal or unsafe characters in the User Agent variable
RewriteCond %{HTTP_USER_AGENT} ^.(<|>|'|%0A|%0D|%27|%3C|%3E|%00). [NC,OR]
Measures to block out SQL injection attacks
RewriteCond %{QUERY_STRING} ^.(;|<|>|'|"|)|%0A|%0D|%22|%27|%3C|%3E|%00).(/*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC,OR]
Block out reference to localhost/loopback/127.0.0.1 in the Query String
RewriteCond %{QUERY_STRING} ^.(localhost|loopback|127.0.0.1). [NC,OR]
Block out use of illegal or unsafe characters in the Query String variable
RewriteCond %{QUERY_STRING} ^.(<|>|'|%0A|%0D|%27|%3C|%3E|%00).
End of commented Rewrite directives
-
... in quest altro sito http://www.conveyor-belt-sushi.com ho creato il .htaccess (vedi sotto) così come indicato in questo tutorial (http://trovalost.it/2015/05/come-impostare-la-cache-del-browser-via-htaccess/)
nonostante questo, page speed tools mi dice comunque: "Utilizza la memorizzazione nella cache del browser per le seguenti risorse memorizzabili nella cache:- http://www.conveyor-belt-sushi.com/assets/animate.css/animate.min.css (scadenza non specificata)
- http://www.conveyor-belt-sushi.com/…rousel-swipe/bootstrap-carousel-swipe.js (scadenza non specificata)
- ...."
... ma perchè?? Cosa sbaglio?? :bho:
.htaccess =
<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 text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule><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>
-
... uffa, ma perchè continua a dirmi che "scadenza non specificata" anchee se come si vede ho inserito i percorsi corretti ???
cosa sbaglio ancora?