Guest Posted May 2, 2014 Share Posted May 2, 2014 Hey everyone, So my host gives me these instructions for setting up our CDN: http://my.aspirationhosting.com/knowledgebase/1438/2-Setup-CDN-with-Your-Website.html All Other Websites (.htaccess Method) 1. Modify your .htaccess file.2. Add the following lines in it:- ExpiresActive On ExpiresDefault A0 # Set up caching for 1 week(s) ExpiresDefault A604800 Header append Cache-Control "public" # Set up caching for 1 day(s) ExpiresDefault A86400 Header append Cache-Control "public" # Set up caching for 1 hour(s) ExpiresDefault A3600 Header append Cache-Control "proxy-revalidate" RewriteEngine On RewriteCond %{HTTP:Via} !\.edge\.worldcdn\.net # Flash wont work on cross-domain by default RewriteCond $1 !^.swf$ [NC] RewriteCond $1 "\.(jpe?g|gif|png|bmp|ico|js|css|pdf|docx?|xlsx?|ppt|rar|zip|tar|gz|tgz|bz2|flv|avi|mov|wmv|mp3|wav|xml|txt)$" [NC] [CDN Hostname]/$1 [L,R] 3. The [CDN Hostname] will be your CDN Hostname like "cdn.yourdomain.com". Was wondering if you guys could advise me on if this will be sufficient for Prestashop? Link to comment Share on other sites More sharing options...
Guest Posted May 2, 2014 Share Posted May 2, 2014 Bump. Do I also need to fill in the media servers with cdn.myurl.com/something? Is there documentation on this? Link to comment Share on other sites More sharing options...
JPresta.com Posted May 5, 2014 Share Posted May 5, 2014 Bump. Do I also need to fill in the media servers with cdn.myurl.com/something? Is there documentation on this? Yes you must set the hostname of your CDN in media servers (just set the first one). This should speeds up your static files (image, css, js, etc.) Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2014 Share Posted May 5, 2014 Hey joe, Thanks I just found that out. I tested it, however on HTTPS pages it was trying to load the https version of my CDN server which apparently does not exist according to my host I need to load the regular http versions on those pages, how do I go about achieving that? Why does Prestashop try to load the https version? Link to comment Share on other sites More sharing options...
JPresta.com Posted May 6, 2014 Share Posted May 6, 2014 A page that is secured must display secured content, that means your images will also be loaded with https. You cannot do an other way. Link to comment Share on other sites More sharing options...
Guest Posted May 6, 2014 Share Posted May 6, 2014 Thanks joe, I will have to bring this information to my host - not sure why they were trying to tell me to do so. I will post the solution once I figure it out. Cheers! Link to comment Share on other sites More sharing options...
TomMayer Posted May 8, 2014 Share Posted May 8, 2014 This was helpful for me http://cdnsun.com/knowledgebase/integrations/prestashop-cdn-integration Link to comment Share on other sites More sharing options...
duongphuc Posted May 9, 2014 Share Posted May 9, 2014 (edited) Let test this code for htaccess, and change underline with your domain name. RewriteEngine OnRewriteCond %{HTTP:Via} !\.worldcdn\.netRewriteCond %{HTTP_HOST} yourwebsite.com [NC]RewriteCond $1 !^.swf$ [NC]RewriteCond $1 "\.(jpe?g|gif|bmp|png|ico|pdf|docx?|xlsx?|pptx?|rar|zip|tar|gz|tgz|bz2|flv|avi|mov|wmv|mp3|wav|xml)$" [NC]RewriteRule ^(.*) http://cdn.yourwebsite.com/$1 [R,L] * only working with image / if you need CSS and JS - add: ...gif|bmp|css|js|... Good luck ! Edited May 9, 2014 by duongphuc (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts