How to use Content Delivery Network on Shared Hosting for WordPress

Content Delivery Network (CDN) is an excellent idea to speed up your Website,Using CDN will definitely increase your website speed which will gives a best performance to the end users and also Search engine bots.In the previous articles I have told you about Your Website speed will affect the Search Engine Ranking.Google and Yahoo are already declared that,they will not going to allow slow loading websites in their search results,this is because to deliver a good content and navigation experience to their visitors.It is also our duty to ensure that performance of Website must be good.If you are using wordpress then this article is for you which helps you how to speed your blog.content delivery network

Content Delivery Network will parallelize the downloads across the host names,it means whenever you request for a web page there are multiple Sub requests will generate for the Images,scripts,css etc.So it takes longer, if you host all the Images,scripts and CSS in one domain.Because after processing the first request only,another request will processed.So it will slow down the page load time.For that we use Content Delivery Network (CDN) to speed up the downloads across the hostnames.I am not going with external and Premium Content Delivery Network Setup.I am talking about making your own Content Delivery Network with WordPress in shared hosting for free.

How to Configure your own Content Delivery Network (CDN) in your Shared Hosting WordPress Blog for Free  :

We have many alternatives for CDN you can use external CDN network but it is cost effective,I think it takes $10 something for the Professional CDN services.Its performance is really good,it will improve your website speed 20 to 30%.But if you can’t afford that amount,simply choose to create your own CDN with the existing domain in WordPress blog using w3 total cache Plugin. Follow these bellow steps to configure the cdn network on your blog with the existing domain.

But before going further you must take a back up of your Entire My SQL database and the Directory data.Remember taking back up is very important,if anything goes wrong you can recover it from the backup,so don’t forget to take a back up.Here I don’t want to make any mess like the other sites which are giving entirely confusing steps.I too really confused earlier but I started to work on it for my self and at last I did it.

Follow these bellow Steps to Configure the CDN with W3 Total Cache Plugin in WordPress :

  1. We need to follow a step by step procedure to get the things work correctly,so first open your FTP client and Login with your domain FTP user account.
  2. Now go to domain home directory,after that if you have .htaccess file please make it writable by giving 777 permissions temporarily.
  3. Now Open wp-config file which is present in your Home directory and paste this bellow piece of code there.     define(‘ENABLE_CACHE’, true);
  4. The above code allow you to use the W3 total cache plugin.Now download the W3 total cache plugin from WordPress.
  5. Extract the Zipped directory and upload the w3 total cache folder to /wp-content/plugins directory,now login in to your WordPress dashboard and Activate the W3 total cache plugin.
  6. Now login in to your hosting control panel and create a sub-domain with a name of  cdn.yourdoamin.com,after that login in to your domain FTP account now you will see two domains,the first one is the root domain and the second is sub-domain.
  7. Go to your root domain download wp-content folder to your local machine.
  8. Now open your sub-domain directory in the FTP and upload the wp-content directory.
  9. Almost the hosting side and server side work is done,now its time for the configuration part in W3 Total cache in WordPress.
  10. Go to wordpress settings tab, and select W3 total cache,and in the General settings tab now enable the Page Caching feature and Select Disk Enhanced method.
  11. Now select minify option and select the Disk method,Please only use Disk method if you use Shared hosting,in case if you have dedicated or VPS type Plan then you can use the different methods.
  12. And select your Content Delivery Network (CDN) as Self Hosted/File Transfer Protocol Upload.
  13. Under page cache settings,select Compression method as Gzip and Deflate,this will reduce your page size and loads your page more speed.Save the Configuration.
  14. Now go to CDN Settings and select the Host active theme files,you can use themes and even wp-include files also.But using wp-include files some time gives errors.
  15. After that, select  Force over writing of existing Files,and click save changes.
  16. Now you can see the FTP settings bellow to it,There you have to give your Web hosting FTP settings,first your Hostname,your hosting FTP username and password.
  17. Give the FTP path as    /cdn.yourdomain.com.And give Replace site’s hostname with cdn.yourdomain.com.Please see the bellow image.Configuring FTP settings for Content delivery network in wordpress w3 total cache
  18. Now click on Save changes,after that try to Empty all the cache,this will create a new Cache page with all the changes made.
  19. Now just try to open your website,you can see a dramatically improved website.This works for me,and I am sure it will work for you also.Any problem please send me at arafath@solvater.com.
About Arafath Hashmi

Arafath Hashmi is a Blogger from 2007 and he wrote 700 and above articles for solvater.com, He is a Senior SEO Analyst.

Comments

  1. it was very interesting to read solvater.com
    I want to quote your post in my blog. It can?
    And you et an account on Twitter?

  2. I would like to appreciate your innovative thoughts that are awesome and your posting style is also superb! I would like to read your next post.

  3. Hello, I like your tutorial and have tried to implement what you have said. However, I cannot get the cdn nor the expires headers feature to work properly. My main concern is that I cannot get the plugin to successfully connect via ftp. I have tested the connection with an ftp program so I know the settings are correct. Others have the same problem and after testing your site, I see you have the same problem. Would you have any insight to this? Thank you.

    • Hi Jessica,

      I got your issue, you need to copy the .htaccess file from root domain to CDN subdomain ( Don’t delete the root domain HTACCESS file). So the same rules will be applicable to the content which is served from CDN.I hope this will resolve your issue.

      • thank you for you reply, I only wish that worked. Darn. I put an exact copy of the .htaccess file in my cdn directory and made sure the privileges were the same. Anything else that could cause this? I think yours is not working either. I tried the YSlow plugin to test your site and others using the w3 total cache and everyone is failing this – Grade F on Use a Content Delivery Network (CDN) and this – Grade F on Add Expires headers. When you are in your admin area, does the ftp connect test pass on your site? I have written the makers of the plug regarding this, I hope someone knows how to fix it. Thank you again for your reply and tutorial.

        • Hi Jessica,

          Now I understand your issue.. Yslow directly can’t find your CDN network..For this you need to add the CDN network name in your Firefox configuration….To do this follow this below procedure..

          Open Firefox, in the address bar type about:config
          It will prompt for confirmation after that in the search bar type yslow now you will find one entry with this name just change that URL to your CDN network name… means cdn.dontgetburnedblog.com
          Restart the browser…Now check again.

  4. great great post

  5. at the end i have a problem
    1. when i want to set ftp setting]:
    error: Unable to change directory to: cdn.archdownload.com (ftp_chdir() [function.ftp-chdir]: Can’t change directory to cdn.archdownload.com: No such file or directory).

  6. i found something
    i changed ftp path to public_html/cdn
    and now its ok :)

  7. usefull artisle , going to implement om my site.

  8. Angela Zhang says:

    how do i configure cloudflare cdn with w3 total cache plugin?

  9. You should remind people that this blog is very outdated and that w3total cache has been updated many times over. This tutorial, as helpful as it may have been years ago will only break your site if you have a up to date version of w3total cache. I followed your steps to the T and dotted all of my i’s and it only broke my site. My only saving grace was that I made a back up of my DB at the beginning.

    • First of all, it is not outdated. I have always checked it whether it works normally or not. I am sure that it is not the configuration which broke your website, it was something else. If you can give me the error, then I can tell you what exactly has happen. Also you need not to restore your whole DB, just delete the w3tc plugin files, that will do the job. Plugins won’t break the whole website in most of the cases.

Speak Your Mind

*

css.php