I am using multiple subdomains to serve static images on my vBulletin site and have the following rules in my .htaccess file, but when I run a Page Speed test against it it gives me a list of images without expires on them and all are from subdomains. How do I include images from subdomains? My .htaccess file is located in /public_html. I tried creating one in <root> but that had no effect. Any thoughts? <ifModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html "access plus 1 seconds" ExpiresByType image/gif "access plus 2592000 seconds" ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType text/css "access plus 604800 seconds" ExpiresByType text/javascript "access plus 216000 seconds" ExpiresByType application/x-javascript "access plus 216000 seconds" </ifModule> <ifModule mod_headers.c> <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif)$"> Header set Cache-Control "max-age=25920000, public" </filesMatch> <filesMatch "\\.(css)$"> Header set Cache-Control "max-age=6048000, public" </filesMatch> <filesMatch "\\.(js)$"> Header set Cache-Control "max-age=2160000, private" </filesMatch> <filesMatch "\\.(xml|txt)$"> Header set Cache-Control "max-age=2160000, public, must-revalidate" </filesMatch> <filesMatch "\\.(html|htm|php)$"> Header set Cache-Control "max-age=1, private, must-revalidate" </filesMatch> </ifModule> <ifModule mod_headers.c> Header unset ETag </ifModule> FileETag None <ifModule mod_headers.c> Header unset Last-Modified </ifModule> Code (markup):
You would do it via FTP, to find the subdomain folder locations in cPanel click on the subdomains icon then it should list all your subdomains and the path to each e.g. public_html/subdomain1 Once you know those just connect with your FTP client and upload the .htaccess for image caching to that folder.
Hey there. Try to add something like this to your vhost settings: ExpiresActive On ExpiresByType image/png "now plus 365 days" ExpiresByType image/jpeg "now plus 365 days" ExpiresByType image/gif "now plus 365 days" ExpiresByType text/css "now plus 365 days" Code (markup): Now the graphics are NOT loaded if they are not modified. We use one domain for css/js/images only that does not send cookies and ofcourse gzip's everything. Make sure all modules are loaded (mod_expires, mod_headers and mod_deflate). Here is a good explanation: http://www.websiteoptimization.com/speed/tweak/cache/ Have fun experimenting By the way, I am fine with my vhost settings. Most of the sites I have done have a Page Speed of 91+ Regards, Michael