Jump to content

Using CDN w/ Prestashop


Guest

Recommended Posts

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

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

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

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

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

Let test this code for htaccess, and change underline with your domain name.

 

RewriteEngine On
RewriteCond %{HTTP:Via} !\.worldcdn\.net
RewriteCond %{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 by duongphuc (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...