Nowadays,optimization of site is most important and it’s good idea to use cookie free domains for static content in WordPress.Static contents are like images, JavaScripts and CSS.
Cookie Free domain is the separate domain which will not serve cookie and speed up your website.You can create sub domain for serving a static content so when browser load content from separate cookie free domain will not send cookie data.
To Setup a Cookie Free Domain
Let’s understand cookie free domain concept. It’s very easy to setup in WordPress.First of all, create a cookie free sub domain. By default, top-level domain cookie will be included into subdomain requests also.
In wordpress, You can define that to serve cookie for domain or not so once you setup, cookie will not get shared on subdomain.
Make sure that you have used “bloginfo(‘template_directory’)” to load your static content in theme files.
Let’s checkout the steps to set up cookie free domain in wordpress:
After creating a subdomain like static.domain.com, point out the domain to the wp-content directory of wordpress.
Now, Open your wp-config.php
file of wordpress and add the following line of code into it.
1 2 3 4 | define("COOKIE_DOMAIN", "www.domain.com"); define("WP_CONTENT_URL", "http://static.domain.com"); |
That’s it. Now load your site in browser ,you can see that the perfomance of website is increase and loading content faster.
Further Reading:
To Configure Auto Updates in WordPress
Pagination when getting posts from category in WordPress
To Exclude Latest Post from the WordPress Loop
Hope this article helpful to someone.As always, thanks for reading an article. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.And if any query,write to me on comment section.I would like to answer your query.
Comments (16)