If you are using Pagespeed to speed up your OScommerce shop, you most likely have this at the top of the Pagespeed Score analysis list:
“Serve Static Content From a Cookieless Domain”
Here is how to set up a cookieless domain for your OSCommerce shop.
- Buy a domain name, set up a new website, and put nothing in it but an empty .htaccess file
- Buy and install an SSL certificate for this domain. You need to have an SSL certificate because the secure pages on an OSCommerce shop will not request images from a nonsecure site.
- Paste the code below into the empty .htaccess file. This will ensure that domain will not serve up cookies.
# 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 2014 23:59:59 GMT" </filesmatch>
.htaccess code courtesy of:http://www.kevinworthington.com/set-cookieless-domain/
Move the content from your OSCommmerce shop and reference it:
- Copy your css, js files and the images folder to the same folders in your new domain. If your css files are in a folder on your current website called ‘css’, then create a folder called css on the cookieless website for that css file. You need to match the folder relationships of the original site on the cookieless site. For example if the css references in css/styles.css are looking for images in the buttons/images folder, on the original site, they are not going to find the images on cookieless site if you place the images in the images folder, but will find them on the new site in the buttons/images folder.
- Open includes/configure.php and add the new reference. Example:
note: now each time you change an image in your real site, you will need to manually change it to match on the cookieless site.
to this format:
note: This format keeps the dreaded Internet Explorer warning about ‘secure and insecure content’ from popping up.
If you have Firebug installed on Firefox, you can see what happens. Open Firebug, click the ‘net’ tab and load your site. You will see 6-12 items lined up under timeline, instead of 1-6 items, and a subsequent shorter load time.