Tag: Website Speed

  • Three Love Hate Factors Which Affect Website Load Time

    Three Love Hate Factors Which Affect Website Load Time

    As a blogger and webmaster, I am obsessed with it comes to speed up website load time. In fact, who doesn’t right? Do you know that websites that has good loading speed score well on search engine page results? Maybe I just took it to another level. Anyway, over the past few days, I managed to speed up my website with these three main components:

    • Minify
    • Gzip
    • Combine CSS

    Before you proceed reading the rest, ask yourself these questions:

    1. Do you know what it takes to build a website that loads fast?
    2. What is the importance of a fast loading site?
    3. Are you doing enough in terms of optimizing your lovely website?

    Not too techie to do website optimization? This article is going to blow your mind away. So, bookmark this page or share with your friends as I am sure you would need this somewhere down your blogging career.

    As for the record, I am not interested to hire a SEO or a website developer for the matter. Therefore, Google was my closest ally that I could get without paying a fee. After some searching, I decided to use only two tools which are ySlow and GTmetrix to measure the speed of my website.

    Note: ySlow is integrated in GTmetrix and therefore, you may use GTmetrix only.

    Website load time is important in terms of SEO and website ranking
    What are the three things that affect website loading speed? 

    What did I do to reduce my website load time?

    Before solving any problem, you need to know where the problem lies. According to GTmetrix, I am having serious load issues on several parts which are:

    • Combine external CSS
    • Avoid CSS @ import (there is no space between @ and import)
    • Gzip compression
    • Minify CSS

    Just a side note: If you are very interested to know more about CSS, I would recommend you this: HTML and CSS – Design and Build Websites.

    Honestly, having this four issues was already a big headache and I was affected with slow loading speed and super low score for ySlow.

    Since search engines do not like slow websites, I was determined to spend the whole day even days to get this resolved, without the help of any paid services.

    Yes, I was just that determined!

    Something I got to add to all WordPress users

    I am using WordPress and I always do. There are probably hundreds of WordPress themes out there and choosing the right one is more than just important.

    The right WordPress themes are usually:

    • Very clean in coding works
    • Build in SEO features
    • Ready to use out of the box
    • Offer customization where the sky is your only limit
    • Unlimited support when you face issues with your themes

    It doesn’t matter if you are running a corporate, e-Commerce or a simply website…you need a good WordPress theme and I can only recommend you two which are the best premium WordPress theme I ever seen; Genesis Framework and child themes by StudioPress and Thesis themes by DIYthemes.

    I am using Genesis Framework and it really help me to reduce my website load time. This is my website load speed after I did several website optimization and I do not use any Content Network Delivery.

    Website loading speed plays a huge role in terms of website ranking
    Pingdom Tool is a great tool to measure website loading speed 

    Searching for free help as much as possible

    I didn’t have what it takes to do it fast and I wasn’t sure if I can do it correctly. My first spot was getting help from my hosting provider. Of course, it wasn’t that much of a help really with the reply that I had a huge external scripts which was well over 50k bytes and many external script files.

    Even though that wasn’t much of a help, I roughly knew something was wrong in the script. Just an assumption of course!

    With the data provided by GTmetrix, I decided that I could Google and solve the problem (one by one).

    Solving Avoid CSS @ import

    Honestly, I had no idea what this was. I had a look at style.css and tried to find what was wrong. I saw the term @ import and I read what it was. It was actually importing fonts for every request to load my page. Head over to my Homepage and check the different fronts available on your screen. Yup, that’s it!

    Just follow the below steps to solve the @ import issue.

    Original:

    @ import url(“style.css”)

    Replace to:

    <link rel=”style.css” href=”style.css” type=”text/css”>

    See the style.css above? Change them according to the original URL for importing.

    Sounds very easy right?

    Minify CSS files to control your website load time

    I Google-d around and found out about minifying CSS files. I was using W3 Total Cache and I thought it had done what it was suppose to be. However, there are some files which cache plugins are not able to minify.

    I read a lot about minify and in short, minify means combining and merging codes to be small in side. The lesser and shorter the code is, the faster your website will load. Enough said.

    I headed over to my Style.css (Appearance > Editor > Style.css). This is a risky procedure and thus, you could access style.css through your cPanel which is safer. In case of any mistake done, you could easily revert the changes.

    There are many online minify tools that you can use for this matter. You can use anyone which you can find on Google or use this: CSS Drive

    Copy down your the whole script or any part of the style.css that you want to minify. Then, paste the code in the box and press compress. New codes will be available once the screen refresh and paste it on your style.css (you should override the old setting). Refresh your website and see if it loads up correctly.

    Reduce website load time by compressing external CSS files

    If you had understand the concept behind the above action, you are going to understand this completely. What you did was minify just one CSS file. Now, choose as many related css files and then combine all into one.

    Tip: You may skip this as not all css files can be merged together

    How to enable Gzip compression on WordPress?

    Enabling Gzip compression will help to speed up the website loading time and reducing the bandwidth required to load your site. To do so, head over to your .htaccess through your cPanel and paste the below code into the script.

    <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>

    Save the file and reboot. You should notice a faster loading time now for your website.

    Was that I did to speed up my website loading time?

    Nope, I did more than that. I even have W3 Total Cache plugin and Cloudflare working together to boost my website speed. Not only that, I even have a subdomain which perform as a cookie-free domain to serve static content to my main site.

    If you want to follow my steps, you can click on the links above and they will bring you to complete, step by step guides in speeding up your website.

    To ensure that you had done everything correctly, refer back to GTmetrix and check on the scorecard. You should probably see a huge improvement compared to the previous one.

    My website scored a pretty nice score at the end of this whole process with loading speed of slightly below 2 seconds and scoring A’s for both Google Page Speed and ySlow.

    Website loading speed plays a huge role in SEO and search engine ranking.
    Do you want to speed up your website effectively? 

    This whole process could take your about an hour to three max to finish it completely. Share with me your scorecard and if you have any other tips, do tell us as well using the form below.

    Like this article? Please help me to share using the red button.

  • Serve Static Content From Cookieless Subdomain for CloudFlare (Updated 2018)

    Serve Static Content From Cookieless Subdomain for CloudFlare (Updated 2018)

    Interesting read: Money Brighter is one of the best LLC in Texas! If you are thinking of speeding up your website, Google might be telling you the answer is to create a cookieless subdomain or domain. Well, that’s easy for you to say. How to serve static content from a cookieless domain? More importantly, what is a cookieless subdomain?

    Instead, you can consider a cookieless subdomain is a term to describe data transferring from one point to another (in this case, data movement from subdomain to domain) has no cookies attached. Indirectly, this boost the loading speed of your domain.

    This is what Google explain in its own words:

    ​Why is serving static content over cookieless domain important?

    ​Static content, such as images, JS and CSS files, don’t need to be accompanied by cookies, as there is no user interaction with these resources. You can decrease request latency by serving static content from a domain that doesn’t serve cookies. This technique is especially useful for pages referencing large volumes of rarely cached static content, such as frequently changing image thumbnails, or infrequently accessed image archives. We recommend this technique for any page that serves more than 5 static resources. (For pages that serve fewer resources than this, it’s not worth the cost of setting up an extra domain.)

    ​​What does this means to you?

    All static contents or data that are transferred with the accompanied by cookies. Though cookies are not needed for any transaction and do not serve any advantage, they will automatically be available for all data transfer. The only way to avoid such is when static contents are obtained from a cookieless site.

    ​Static content + ​cookieless domain?

    ​Serving static content or resources from a cookieless domain reduces the total size of requests made for a page. It is also important to note that there is no point setting up static subdomain for this matter if you are using a powerful web host or having very less page.

    ​Now that we had gone through the relationship between cookieless subdomain and serving static content, let’s explore the right way to serve the following static resources from a domain that doesn’t set cookies.

    ​How to create a cookieless subdomain using CNAME?

    ​When it comes to creating a cookieless subdomain, using a CNAME could be the easiest way of all​ (at least for me). This step is extremely easy to follow and ​after configurations, you can start serving static resources from a domain that doesn’t set cookies.

    • ​Go to your cPanel (most shared web hosting offers this)
    • ​Create a subdomain (any name would do, e.g. static.domain.com)

    ​This subdomain will serve as a CDN subdomain which is the key criteria to enable the process of serving static content from cookieless domain.

    Selecting the right installation path for the subdomain

    In order to create a proper cookieless subdomain, you have to ensure that when you are creating your subdomain, make sure it is pointing to your root directory instead of creating a secondary one. For example, my root directory is /public_html and thus, it should be pointed or directed to /public_html and not the default, /public_html/static.

    How to create a subdomain?
    This is what you see when you are pointing to subdomain to the right path 

    Editing the DNS Zone

    Once you have done pointing the subdomain, head over to your DNS Zone Editor. At times, these might be labeled as Simple or Advanced DNS Zone Editor for several types of cPanel but they are all alike.

    How do you create a subdomain for serving static content?
    Pointing subdomain to the right domain 

    You would need to either create or modify the Name to your subdomain name and CNAME as your main domain. Of course, for the Type, you would need to select CNAME. You may start this by hitting the create button and if there is already a record, you just need to modify the settings to the above.

    Still not sure? Let me explain to you, in other words. When you create the CNAME record you want to enter your static domain/subdomain as the label, name or an alias and your A record domain as the content or value. (The CNAME term, which stands for Canonical Name, actually refers to the domain you are mapping to, not the alias.  The common practice of referring to the alias as the CNAME is in fact backwards.) 

    Making sure the subdomain is cookieless

    I could not emphasize how important this is but you must not skip this step no matter what. In WordPress, there are two common cookie-setters which are WordPress and Google Analytics. All you need is to do little changes in the configurations and you would be well on your way to a cookieless subdomain.

    For WordPress, head over to your wp-config by login into your cPanel. Open it up and add this line to the file. If you are wondering where exactly you may place this file, you can place it at the bottom most of the script.

    define(‘COOKIE_DOMAIN’, ‘www.yourdomain.com’);

    This is definitely a no-brainer but just to make sure, do remember to change your domain to your own domain name. After that, save the file and you are good to go!

    For Google Analytics, all you need to do is to search for the specific code you had earlier placed in on your site and replace the code with the below one. For a quick tip, most Google Analytics code is kept close to the <body>.

    _gaq.push( [‘_setAccount’, ‘UA-xxxxxxx-1’], [‘_setDomainName’, ‘www.yourdomain.com’], [‘_trackPageview’] );

    Again, change your domain as seen above to your own domain URL and save the file.

    Important note: If you are using cloudflare or any type of Content Network Delivery (CDN), please get your hosting and CDN provider to verify on the CNAME. For example, using Cloudflare will give you an error when you are following the above guide in changing the CNAME. Basically, the hosting or CDN provider will give you a new A figure to place in. 

    You are all done!

    Now, treat yourself to a bottle of beer for the hard work and congratulations. You had managed to create a cookieless subdomain from scratch. This is one of the cheapest (and fastest) way to create a cookieless subdomain when it comes to serving static content to improve your website speed.