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


Some redirect, example:


redirects to


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, 2015 at 2:58

2 Answers 2


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]

I had a similar issue for Magento 2.

In our case we had forgot to add media resource for a custom sub-folder in the media directory. If this isn't done, access isn't allowed from outside the base domain.

You can add additional folders like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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