{"id":444,"date":"2012-03-02T09:37:46","date_gmt":"2012-03-02T08:37:46","guid":{"rendered":"http:\/\/losego.info\/servizi\/?p=444"},"modified":"2012-03-02T09:41:39","modified_gmt":"2012-03-02T08:41:39","slug":"wordpress-nuovo-htaccess-migliori-prestazioni-rispetto-mod_slotlimit","status":"publish","type":"post","link":"https:\/\/losego.info\/servizi\/2012\/03\/02\/wordpress-nuovo-htaccess-migliori-prestazioni-rispetto-mod_slotlimit\/","title":{"rendered":"WordPress: un nuovo .htaccess per migliori prestazioni e rispetto mod_slotlimit"},"content":{"rendered":"<div class=\"art-article\">\n<p>La configurazione di default del CMS WordPress prevede un sistema di riscrittura degli indirizzi basato sull&#8217;utilizzo del file &#8220;<strong>.htaccess<\/strong>&#8221; (scritto con il punto iniziale). Vedremo ora come renderlo meno intrusivo e <strong>massimizzarne le prestazioni<\/strong>.<\/p>\n<p>La seguente configurazione di &#8220;.htaccess&#8221; viene utilizzata nelle recenti versioni di WordPress (fino alla 3.0.x):<\/p>\n<pre style=\"margin-top: 0px; margin-right: 0px; margin-bottom: 11px; margin-left: 0px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f0f0f0; font-size: 11px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; color: #000000; background-position: initial initial; background-repeat: initial initial; padding: 11px; border: 1px solid #dadada;\"><code style=\"font-style: normal; font-weight: normal; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; color: #000000; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f0f0f0; background-position: initial initial; background-repeat: initial initial;\"># BEGIN WordPress \r\n&lt;IfModule mod_rewrite.c&gt; \r\nRewriteEngine On \r\nRewriteBase \/ \r\nRewriteCond %{REQUEST_FILENAME} !-f \r\nRewriteCond %{REQUEST_FILENAME} !-d \r\nRewriteRule . \/index.php [L] \r\n&lt;\/IfModule&gt; \r\n# END WordPress<\/code><\/pre>\n<p>Questa serie di regole \u00e8 molto inefficente in quanto, al caricamento \u00a0di<strong>\u00a0ogni file che compone\u00a0la pagina web<\/strong>, esegue un ciclo di ricerca supplementare per verificare l&#8217;esistenza del file.<\/p>\n<p>Il problema si complica, inoltre, nel caso in cui il proprio servizio di hosting preveda limitazioni di banda. Se tali limitazioni relative al numero di file caricati (<strong>mod_slotlimit<\/strong>), come ad esempio nel caso del provider italiano Tophost, si ottiene l&#8217;effetto di fare scattare il limite di soglia anche caricando una sola pagina web, in quanto tutti i suoi componenti (immagini, fogli di stile) vengono fatti passare attraverso l&#8217;interprete php e quindi trattati come fossero pagine web indipendenti. In breve, tutto questo porta al fatidico messaggio di errore:<\/p>\n<p><code style=\"background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; font-size: 1em; list-style-type: none; text-decoration: none; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;\">Blocked by mod_slotlimit. More information about this error may be available in the server error log.<\/code><\/p>\n<p>Suggeriamo quindi di sostituire il contenuto del file &#8220;.htaccess&#8221; con le righe seguenti:<\/p>\n<pre style=\"margin-top: 0px; margin-right: 0px; margin-bottom: 11px; margin-left: 0px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f0f0f0; font-size: 11px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; color: #000000; background-position: initial initial; background-repeat: initial initial; padding: 11px; border: 1px solid #dadada;\"><code style=\"font-style: normal; font-weight: normal; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; color: #000000; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f0f0f0; background-position: initial initial; background-repeat: initial initial;\">\r\n# BEGIN WordPress\r\nRewriteEngine On\r\nRewriteBase \/\r\n# if this request is for \"\/\" or has already been rewritten to WP\r\nRewriteCond $1 ^(index\\.php)?$ [OR]\r\n# or if request is for image, css, or js file\r\nRewriteCond $1 \\.(gif|jpe?g|png|css|js|ico)$ [NC,OR]\r\n# or if URL resolves to existing file\r\nRewriteCond %{REQUEST_FILENAME} -f [OR]\r\n# or if URL resolves to existing directory\r\nRewriteCond %{REQUEST_FILENAME} -d\r\n# then skip the rewrite to WP\r\nRewriteRule ^(.*)$ - [S=1]\r\n# else rewrite the request to WP\r\nRewriteRule . \/index.php [L]\r\n# END WordPress\r\n\r\n<\/code><\/pre>\n<p>I miglioramenti apportati sono i seguenti:<\/p>\n<ul>\n<li><span style=\"color: #3d3d3d;\">il blocco di controllo &lt;ifmodule&gt; \u00e8 rimosso per guadagnare velocit\u00e0<\/span><\/li>\n<li><span style=\"color: #3d3d3d;\">la riscrittura viene evitata se la pagina da caricare \u00e8 la &#8220;index.php&#8221;, cio\u00e8 la pagina iniziale<\/span><\/li>\n<li><span style=\"color: #3d3d3d;\">la riscrittura viene evitata per i file statici di tipo immagine, javascript e css<\/span><\/li>\n<\/ul>\n<p>Utilizzando le nuove regole si <strong>abbasser\u00e0 notevolmente il tempo di caricamento<\/strong> della pagina, considerando che saranno evitati numerosi cicli di ricerca relativi al check di esistenza dei file statici, e si risolveranno gli eventuali problemi nel controllo di banda tramite mod_slotlimit.<\/p>\n<p>&nbsp;<\/p>\n<p>fonte:\u00a0<a href=\"http:\/\/www.whiletrue.it\/it\/blog\/wordpress\/19-wordpress-un-nuovo-htaccess-per-migliori-prestazioni-e-rispetto-modslotlimit.html\">http:\/\/www.whiletrue.it\/<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>La configurazione di default del CMS WordPress prevede un sistema di riscrittura degli indirizzi basato sull&#8217;utilizzo del file &#8220;.htaccess&#8221; (scritto con il punto iniziale). Vedremo ora come renderlo meno intrusivo e massimizzarne le prestazioni. La seguente configurazione di &#8220;.htaccess&#8221; viene utilizzata nelle recenti versioni di WordPress (fino alla 3.0.x): # BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/losego.info\/servizi\/2012\/03\/02\/wordpress-nuovo-htaccess-migliori-prestazioni-rispetto-mod_slotlimit\/\">Continua a leggere<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,34,32,31,4],"tags":[145,93,144,147],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-cms","category-hosting","category-php","category-seo","category-wordpress","tag-ottimizzazione","tag-php-2","tag-seo-2","tag-wordpress","item-wrap"],"_links":{"self":[{"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":0,"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"wp:attachment":[{"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/losego.info\/servizi\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}