1

just finished the CDN set up for our magento store. Some images/css/js files are loaded fine from cdn server. But some cdn versions redirect back to our hosting.

I mean some files can be accessed on cdn - example

http://cdn.domain.com/media/wysiwyg/logo-dark.png

Some redirect, example:

http://cdn.domain.com/skin/frontend/rwd/green/images/media/logo.png

redirects to

http://www.domain.com/skin/frontend/rwd/green/images/media/logo.png

What can be the reason for this?

The bytes by domain shows that about 40% sourced by cdn.domain.com and 55% by domain.com. I guess it's not like it supposed to work?

Here are the settings.


Found the problem. It was caused by htaccess code:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ http://www.domain.com/.com/$1 [R=301,L]

This code supposed to redirect /index.php/ to route. Why does it mess around with cdn.domain.com?

  • Make sure all of your Images/CSS/JS are uploaded to the CDN. You may also checkout github.com/onepica/imagecdn module to help faciliate images. – B00MER Nov 10 '15 at 2:58
0

Not sure why it's updating your CDN, but I don't have full access to your server setup.

Try this. It says only rewrite if not on the CDN. Of course, update domain.com in both cases:

RewriteCond %{HTTP_HOST} !^cdn.domain.com$ [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ http://www.domain.com/.com/$1 [R=301,L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.