I am using a CDN with my shopp installation. I used super cache to do most of the setup for getting my content on the cdn. However, the images that are served by the database (product images) are not being pulled from the cdn. I did check that they exist on the cdn.
i know that you need to do something to the htaccess file and this is what i got so far
RewriteEngine On
RewriteBase /
RewriteRule ^.shop/images/(\d+)/?\??(.)$ http://cdn.example.com/shop/images/$1/?$2 [L,R=301]
but it doesn't seem to work. anyone know a sol开发者_高级运维ution?
The Query String (everything after ?
) cannot be matched in RewriteRule directive.
RewriteEngine on
RewriteRule ^shop/images/(\d+)/ http://cdn.example.com/shop/images/$1/ [NC,QSA,R=301]
The above rule only matches URL, the query string (e.g. ?280,340,667194571
) will be passed as is (no additional checks -- what for?). As long as URL is in this format shop/images/{some_digits_only}/
(e.g. example.com/shop/images/73/
) it will issue Permanent redirect (301) and URL in browser will be changed to CDN URL (e.g. http://cdn.example.com/shop/images/73/?280,340,667194571
).
精彩评论