{"id":4694,"date":"2012-02-08T11:38:39","date_gmt":"2012-02-08T16:38:39","guid":{"rendered":"https:\/\/webhostinggeeks.com\/blog\/?p=4694"},"modified":"2021-10-19T06:49:05","modified_gmt":"2021-10-19T10:49:05","slug":"wordpress-website-speed-optimization","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/blog\/wordpress-website-speed-optimization\/","title":{"rendered":"Top 9 Ways to Optimize Your WordPress Server for Blazing Fast Speeds"},"content":{"rendered":"<p>When it comes to content management and coding efficiency, <a href=\"https:\/\/wordpress.org\/\" target=\"_blank\" rel=\"noopener\">WordPress<\/a> tends to be one bad mother. Where other content management systems might chug and chortle, WordPress tends to serve up your content with a markedly improved efficiency that makes the folks over at <a href=\"https:\/\/www.drupal.org\/\" target=\"_blank\" rel=\"noopener\">Drupal<\/a> shiver in their boots. However, just because WordPress is built from the ground-up to be faster does not mean it is optimized out of the box for your server: In fact, if you neglect to modify a few key parameters early in your blog or websites installation, you may find your content getting stuck in the pipes. This translates to longer load times, and if you\u2019re especially neglectful, unhappy end-users. That\u2019s a fate we\u2019d very much like to help you avoid, so with that in mind, we\u2019ve prepared a few of our top ways in which you can dramatically increase the speed of your already quick WordPress server.<br \/>\n<!--more--><br \/>\nTo get the most out of our handwork, we suggest you simply work your way through the list, modifying your server as needed, and skipping the areas you\u2019ve already completed. If you follow our directions to the letter, we promise you\u2019ll emerge with a much faster system\u2014Or your money back! So before you realize we\u2019re doing this at no charge to you, let\u2019s jump straight into the heart of the matter with:<\/p>\n<h3>1. Serve Your Static Media from a Cookie-Less Domain<\/h3>\n<p>About 80 to 90% of the time, your users are spending their time loading static content from your WordPress blog. This means that far more than the majority of the time a user is viewing your site, they\u2019re waiting for items like images, stylesheets, scripts, Flash, etc. to load and present themselves on the screen. As such, you can optimize this content to arrive more quickly by telling WordPress to load it all from a cookie free domain. This eliminates a few precious micro-seconds of load time, which may not seem like much, but can really amount to a whopping time loss when added to other delaying issues.<\/p>\n<p>Thankfully, it\u2019s not hard to set up this kind of arrangement within WordPress. To do so, simply set these two constants within your wp-config.php file as so:<\/p>\n<p><strong>define(&#8220;WP_CONTENT_URL&#8221;, &#8220;http:\/\/static.yourdomain.com&#8221;);<\/strong><\/p>\n<p>define(&#8220;COOKIE_DOMAIN&#8221;, &#8220;www.yourdomain.com&#8221;);<\/p>\n<p>After you\u2019ve done that, just check to be sure you\u2019ve marked \u201cbloginfo( \u2018template_directory\u2019 )\u201d to load your static content within your theme files. That\u2019s it, allowing us to move onto point two!<\/p>\n<h3>2. Set-Up Cached Headers to Expire for Your Static Content<\/h3>\n<p>Serving up cached media is another great way to reduce load times. Thankfully, creating expiring headers for your static content is also fairly easy to do within WordPress, and can save you a lot of lag-based headaches. The best way to do so is to use the following code form the <a href=\"https:\/\/html5boilerplate.com\/\" target=\"_blank\" rel=\"noopener\">HTML 5 Boiler Plate<\/a>. You can append it to your .htaccess file for immediate results. This, essentially, tells your server to expire headers at a future date, saving them in a cached format until that expiration date. So without further ado, here\u2019s the code to get the job done!<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n<code>&lt;IfModule mod_expires.c&gt;<br \/>\nExpiresActive on<br \/>\n# Perhaps better to whitelist expires rules? Perhaps.<br \/>\nExpiresDefault\u00a0\u00a0\u00a0\u00a0\u00a0 \"access plus 1 month\"<br \/>\n# cache.appcache needs re-requests<br \/>\n# in FF 3.6 (thx Remy ~Introducing HTML5)<br \/>\nExpiresByType text\/cache-manifest \"access plus 0 seconds\"<br \/>\n# Your document html<br \/>\nExpiresByType text\/html \"access plus 0 seconds\"<br \/>\n# Data<br \/>\nExpiresByType text\/xml \"access plus 0 seconds\"<br \/>\nExpiresByType application\/xml \"access plus 0 seconds\"<br \/>\nExpiresByType application\/json \"access plus 0 seconds\"<br \/>\n# RSS feed<br \/>\nExpiresByType application\/rss+xml \"access plus 1 hour\"<br \/>\n# Favicon (cannot be renamed)<br \/>\nExpiresByType image\/x-icon \"access plus 1 week\"<br \/>\n# Media: images, video, audio<br \/>\nExpiresByType image\/gif \"access plus 1 month\"<br \/>\nExpiresByType image\/png \"access plus 1 month\"<br \/>\nExpiresByType image\/jpg \"access plus 1 month\"<br \/>\nExpiresByType image\/jpeg \"access plus 1 month\"<br \/>\nExpiresByType video\/ogg \"access plus 1 month\"<br \/>\nExpiresByType audio\/ogg \"access plus 1 month\"<br \/>\nExpiresByType video\/mp4 \"access plus 1 month\"<br \/>\nExpiresByType video\/webm \"access plus 1 month\"<br \/>\n# HTC files\u00a0 (css3pie)<br \/>\nExpiresByType text\/x-component \"access plus 1 month\"<br \/>\n# Webfonts<br \/>\nExpiresByType font\/truetype \"access plus 1 month\"<br \/>\nExpiresByType font\/opentype \"access plus 1 month\"<br \/>\nExpiresByType application\/x-font-woff\u00a0\u00a0 \"access plus 1 month\"<br \/>\nExpiresByType image\/svg+xml \"access plus 1 month\"<br \/>\nExpiresByType application\/vnd.ms-fontobject \"access plus 1 month\"<br \/>\n# CSS and JavaScript<br \/>\nExpiresByType text\/css \"access plus 1 year\"<br \/>\nExpiresByType application\/javascript \"access plus 1 year\"<br \/>\nExpiresByType text\/javascript \"access plus 1 year\"<br \/>\n&lt;IfModule mod_headers.c&gt;<br \/>\nHeader append Cache-Control \"public\"<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/IfModule&gt;<\/code><br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<h3>3. Optimize that Database!<\/h3>\n<p>Another great way to fix your server up to deliver your WordPress site with the most efficiency is to optimize your database. How does one do this? With mountains and mountains of code that take hours to append\u2014We\u2019re kidding! WordPress makes this unbelievably easy, thanks to a number of free plug-ins. You can search the plug-in database for server optimization, but some of our favorites are Yoast Optimize DB and <a href=\"https:\/\/www.apple.com\/\">WP DB Manager<\/a>. Keep in mind too that most caching plug-ins also help with a lot of this, so you may find most of the workload being taken care of by your already extant caching softwares.<\/p>\n<h3>4. Use Cached Media As Much As Possible<\/h3>\n<p>On that note, creating cached .html files saves your server a mountain of database queries, and can easily be accomplished through any number of quality plug-ins. Essentially, these additions turn all those queries into static pages that load easy, saving your viewer from horrendous lag on the front-end. So what plug-ins do we recommend? Thanks for asking! Here are our favorites, though as with the database optimizers, there\u2019s plenty more to be found in the plug-in database!<\/p>\n<p>Our favorite caching utilities include: <a href=\"https:\/\/wordpress.org\/plugins\/wp-super-cache\/\">WP Super Cache<\/a>, <a href=\"https:\/\/wordpress.org\/plugins\/hyper-cache\/\">Hyper Cache<\/a>, and <a href=\"https:\/\/wordpress.org\/plugins\/w3-total-cache\/\">W3 Total Cache<\/a>. These generate .html files, but we also use DB Cache to cache the database queries themselves, saving even more time on the front-end.<\/p>\n<h3>5. Use a Content Delivery Network<\/h3>\n<p>We\u2019re quite tremendous fans of the content delivery network. Everything about the technology gets us excited, and though we tend to evangelize the service to everyone we know, adding a CDN solution to your WordPress site is extremely easy, and can really <a href=\"https:\/\/webhostinggeeks.com\/tools\/cdnspeed\/\">save you a lot of load time<\/a>. There are several freely available plug-ins that offer a fair amount of content distribution, but if you\u2019re looking for a quality option, you really aren going to need to spend a little. However, we should mention the benefits of signing up for a CDN tend to far outweigh the cons, making the following services every bit as useful as they are expensive. If you\u2019re hung-up on the price, though, we\u2019ve also included a free option!<\/p>\n<p>Our favorite content delivery providers are: <a href=\"https:\/\/aws.amazon.com\/s3\/\">Amazon S3<\/a>, <a href=\"https:\/\/www.stackpath.com\/maxcdn\">Max CDN<\/a>, Media Temple CDN, and <a href=\"https:\/\/wordpress.org\/plugins\/free-cdn\/\">Free CDN<\/a>.<\/p>\n<h3>6. Compress and Adjoin All Those JS and CSS Files Where Possible<\/h3>\n<p>Generally speaking, it\u2019s a fantastic idea to compress both your JS and CSS files, as this reduces the overall size of your website, and allows for speedier load times at the end-user level. However, if you\u2019re looking to take your optimization to a whole new level, we also strongly suggest you combine the two where possible. Combining multiple files into a single offering can greatly reduce the number of HTTP requests from your web server, saving your viewers precious seconds in load time. And\u2014you guessed it\u2014we do happen to have a number of plug-ins ready to help you out!<\/p>\n<p>Our favorite JS compressors include <a href=\"https:\/\/closure-compiler.appspot.com\/home\">Closure Compiler<\/a> and Minify JavaScript. Our favorite CSS alternatives are Minify CSS and <a href=\"https:\/\/csscompressor.com\/\">CSS Compressor<\/a>. Alternatively, you can also use the wp minify plug-in to combine your JS and CSS files directly from WordPress.<\/p>\n<h3>7. Compress Your Image Files<\/h3>\n<p>On the subject of compression, it\u2019s also a pretty fantastic idea to compress your images, too. This reduces the overall size of your website, and can knock off quite a few moments during your site\u2019s load time. The plug-in we favor uses the API of the smush.it site to compress your images for optimized use. It\u2019s a brilliant bit of coding, and we can\u2019t speak highly enough of it. So without further ado, go ahead and snag <a href=\"https:\/\/wordpress.org\/plugins\/wp-smushit\/\">WP Smush IT<\/a> to increase the speed of your site. You can also use CSS Sprite to reduce the number of HTTP requests, if you\u2019re feeling particularly gung-ho.<\/p>\n<h3>8. Compress Your Static Content into a gZip<\/h3>\n<p>One more compression tip, and then we promise we\u2019ll stop. You see, just as it\u2019s generally a good idea to compress your CSS, JS, and image files, so is it also a great idea to shrink down all of that extraneous static content we mentioned earlier. Just as most of your load time comes from grabbing this junk, so too can it be relieved by downsizing the overall cost of the HTTP request. Thankfully, there\u2019s an incredibly simple way to do this within WordPress: And taking the time to add the following code snippet can dramatically reduce your wait times. So without any more babbling, here\u2019s the code you\u2019ll want to add to your .htaccess file. In case you were wondering, this is yet another bit of genius straight from the HTML5 Boiler Plate:<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n<code>&lt;IfModule mod_deflate.c&gt;<br \/>\n# force deflate for mangled headers<br \/>\n# developer.yahoo.com\/blogs\/ydn\/posts\/2010\/12\/pushing-beyond-gzipping\/<br \/>\n&lt;IfModule mod_setenvif.c&gt;<br \/>\n&lt;IfModule mod_headers.c&gt;<br \/>\nSetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\\s*,?\\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding<br \/>\nRequestHeader append Accept-Encoding \"gzip,deflate\" env=HAVE_Accept-Encoding<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/IfModule&gt;<br \/>\n# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:<br \/>\n&lt;IfModule filter_module&gt;<br \/>\nFilterDeclare\u00a0\u00a0 COMPRESS<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $text\/html<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $text\/css<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $text\/plain<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $text\/xml<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $text\/x-component<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/javascript<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/json<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/xml<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/xhtml+xml<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/rss+xml<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/atom+xml<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/vnd.ms-fontobject<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $image\/svg+xml<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $application\/x-font-ttf<br \/>\nFilterProvider\u00a0 COMPRESS\u00a0 DEFLATE resp=Content-Type $font\/opentype<br \/>\nFilterChain\u00a0\u00a0\u00a0\u00a0 COMPRESS<br \/>\nFilterProtocol\u00a0 COMPRESS \u00a0DEFLATE change=yes;byteranges=no<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;IfModule !mod_filter.c&gt;<br \/>\n# Legacy versions of Apache<br \/>\nAddOutputFilterByType DEFLATE text\/html text\/plain text\/css application\/json<br \/>\nAddOutputFilterByType DEFLATE application\/javascript<br \/>\nAddOutputFilterByType DEFLATE text\/xml application\/xml text\/x-component<br \/>\nAddOutputFilterByType DEFLATE application\/xhtml+xml application\/rss+xml application\/atom+xml<br \/>\nAddOutputFilterByType DEFLATE image\/svg+xml application\/vnd.ms-fontobject application\/x-font-ttf font\/opentype<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/IfModule&gt;<\/code><br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<h3>9. Disable eTags<\/h3>\n<p>eTags are generally a great way to aide the development of cached content within WordPress. However, if you\u2019ve shrunk down all of your media and are using expiration headers for the majority of your static content, having them enabled isn\u2019t nearly as good of an idea. As such, you should turn all of them off by adding the following line of code to your aforementioned .htaccess file. It\u2019s a single line:<\/p>\n<p><code>File ETag none<\/code><\/p>\n<p>and with all the other improvements we\u2019ve made during the course of this article, it will tie the bow on your load time savings. Don&#8217;t forget to <a href=\"https:\/\/tribulant.com\/blog\/wordpress\/how-to-secure-wordpress-from-hackers\/\" rel=\"noopener\" target=\"_blank\">keep your WP site safe and secure<\/a>.<\/p>\n<h3>Further reading<\/h3>\n<p><a href=\"https:\/\/capsicummediaworks.com\/how-to-speed-up-wordpress\/\" target=\"_blank\" rel=\"noopener\">Check out this awesome blog post by Capsicum Mediaworks<\/a>. These guys reached out to 33 Internet Marketing experts and asked them to share: &#8220;What Are The 3 Biggest Problems Causing WordPress Sites To Load Slowly And How Do You Solve Them?&#8221;. Worth reading, trust me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When it comes to content management and coding efficiency, WordPress tends to be one bad mother. Where other content management systems might chug and chortle, WordPress tends to serve up&#8230;<\/p>\n","protected":false},"author":3,"featured_media":4732,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[10,7],"tags":[3771,3769,1001,77,3765,3926,3768,3770,3772,351],"class_list":["post-4694","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cms","category-seo-sem","tag-cached-headers","tag-cached-media","tag-content","tag-css","tag-etags","tag-files","tag-js","tag-optimize-database","tag-static-media","tag-wordpress"],"views":158,"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/posts\/4694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/comments?post=4694"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/posts\/4694\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/media\/4732"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/media?parent=4694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/categories?post=4694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/blog\/wp-json\/wp\/v2\/tags?post=4694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}