USE COOKIE FREE DOMAINS
Cookie-free domains are intended to serve static files like images, CSS files, scripts, and others. When a browser makes a request for static images, it sends cookies along with the request and thus the user has to waste time and bandwidth while transmitting those cookies.
So if we can create a subdomain and make it cookie-free and point all static resources to it then it can increase our website speed substantially.
Cloudflare adds its own security cookies and so you can never go cookieless while using a Cloudflare CDN.
Serving static files from the cookie-free domain have very low priority and low effect on-site load. So, you can entirely ignore it.
It consists of 3 steps:
Step 1: Creating a subdomain in CPanel
Subdomains are very easy to create.
Go to your hosting provider CPanel> Domain> Sub domain
Put static in place of subdomain and select your domain name and Create.
Your subdomain is created.
Step 2: Using CDN Enabler Plugin to point the static resources to a cookie-free subdomain
Install and activate the CDN Enabler Plugin.
Go to settings> Put your sub-domain in CDN URL
Put static/wp-content in Included Directories and SAVE changes.
You are done.
Step 3: Installing Auto-optimize plugin
This has always been a game-changer plugin for me.
I love the simplicity of its coding and settings.
- Install and activate auto-optimize
- Do the proper settings as shown
For JS, CSS and HTML
For CSS
HTML
Leave the other settings as default.
Next, come to the images tab
Images
Leave the other tab settings as default.
GTmetrix results:
Website design in Oakville
Thursday 14th of January 2021
I like the valuable information you provide in your articles.
I shall bookmark your blog and frequently check again here. I am quite sure I'll learn lots of new stuff the following! Best of luck for the next!
Praveena
Sunday 29th of March 2020
Hi Moumita, I followed your steps using W3 Cache and now my site images are gone. I stopped at SETTING UP 301 RE-DIRECTIONS FOR WORDPRESS IMAGES BY EDITING HTACCESS FILE -Step 6.
Please help me.
moumita
Sunday 29th of March 2020
Hi Praveena, did you get back the images after reverting back the W# steps?
Abdul Qadeer
Saturday 8th of February 2020
Working 100% Thank you very much ..
jojo
Saturday 11th of January 2020
And also can you explain what Add Expires headers are? and how to implement it on the wordpress website?
Paul
Wednesday 11th of March 2020
Just copy and paste the following code to your .htaccess file to resolve the Add Expires header issue.
ExpiresActive on ExpiresDefault "access plus 6 months" # CSS ExpiresByType text/css "access plus 1 year" # HTML components (HTCs) ExpiresByType text/x-component "access plus 2 months" # HTML ExpiresByType text/html "access plus 6 months" # JavaScript ExpiresByType application/javascript "access plus 1 year" ExpiresByType application/x-javascript "access plus 1 year" # Manifest files ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" ExpiresByType text/cache-manifest "access plus 0 seconds" # Media ExpiresByType audio/ogg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/svg "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType video/mp4 "access plus 1 year" ExpiresByType video/ogg "access plus 1 year" ExpiresByType video/webm "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType application/pdf "access plus 1 year" ExpiresByType application/x-shockwave-flash "access plus 1 year" # Web feeds ExpiresByType application/atom+xml "access plus 1 hour" ExpiresByType application/rss+xml "access plus 1 hour" # Web fonts ExpiresByType application/font-woff "access plus 1 year" ExpiresByType application/font-woff2 "access plus 1 year" ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType font/opentype "access plus 1 year"
moumita
Saturday 1st of February 2020
You can check at https://bloggersdayout.com/leverage-browser-cache/
Syed
Monday 17th of June 2019
phpmyadmin showing error and my site images gone :(
moumita
Friday 21st of June 2019
Hi Syed which method did you use?