How to Set Up a Cookieless Domain in Linux
First, let’s discuss what is static content. There are few files which never change as per request, files like images, CSS, js, videos etc. In other words, files that are not used to build dynamic content like PHP, aps(x), JSP. The benefits to removing the cookies from static content are it will reduce the total size of requests made to build the web pages and makes them load faster. Removing the cookies from the request header is one of the performance settings needed to speed up your site. Remember that you still need to cache and compress some files.
First edit or create a .htaccess file on the documentroot of you domain which you want to make cookieless domain. This method will work only with Apache web servers. Add below code in .htaccess file.
# vim /var/www/html/techoism/.htaccess
# Use Mod_deflate to compress static files <ifmodule mod_deflate.c> <filesmatch ".(js|css|ico|txt|htm|html|php)$"> SetOutputFilter DEFLATE </filesmatch> </ifmodule> # Speed up caching FileETag MTime Size # Expires ExpiresActive On ExpiresDefault "access plus 366 days" # Future Expires Headers <filesmatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Expires "Sat, 27 Dec 2018 23:59:59 GMT" </filesmatch>
I hope this article will help you to setup the cookieless domain.