Saturday, December 21, 2024

PageSpeed: Serve static content from a cookieless domain

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, so many web projects use a dedicated domain / subdomain (e.g. static.example.org) for that. If you create a own joomla template you normally moved your “static” web design elements like graphics (e.g. *.png), javascript (e.g. *.jsp) and your Cascade style sheets (*.css) to a subdomain. Now you wish to prevent that a cookie is created on that subdomain. How can this be done?

Add the following lines to your .htaccess inside your image, jsp or css folder:

########## Begin - Disable cookies for static elements subdomain
#
#
<IfModule mod_php4.c>
php_value session.use_cookies 0
</IfModule>
#
<IfModule mod_php5.c>
php_value session.use_cookies 0
</IfModule>
#
<IfModule mod_php6.c>
php_value session.use_cookies 0
</IfModule>
#
<IfModule mod_php7.c>
php_value session.use_cookies 0
</IfModule>
#
#
########## End - Disable cookies for static elements subdomain

For more infos regarding that topic read:

Serve static content from a cookieless domain

Use Cookie-free Domains for Components

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

35FollowersFollow
- Advertisement -

Latest Articles