silviu_25 Posted October 18, 2019 Share Posted October 18, 2019 (edited) Hi, I try to use cookie free domains for media/images, so I created a subdomain named cdn ( cdn.mydomain.com ) and I pointed its root folder to img. I inserted this subdomain in BO>Advanced>Performance and when I refresh FO all images are missing. If I copy image link I get: https://cdn.mydomain.com/473-home_default/image-mane.jpg if I try to access https://mydomain.com/473-home_default/image-mane.jpg image is there So I think I should add cdn.mydomain.com in .htaccess file because: # Images RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^mydomain.com$ RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L] # AlphaImageLoader for IE and fancybox RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L] all jpg links are rerwited to a shorter link like : 473-home_default and they are not pointing to the actual path like /img/p/3/2/7/9/..... So, how can I configure media servers in PS 1.7.6.1? I read on different forums that this is because of Friendly URL id ON (how I would prefer to keep it) LE After more digging on the web I fount that I need to regenerate the .htaccess file after I add the cdn domain by going to BO> SEO & URL> set friendly url to NO and save then set to YES and save. and image path are updated to https://cdn.mydomain.com/473-home_default/image-mane.jpg But here comes another problem: If I try to access https://cdn.mydomain.com/473-home_default/image-mane.jpg I get 403 Forbidden If I try to access https://cdn.mydomain.com/4/7/3/image-mane.jpg image is displayed. Edited October 18, 2019 by silviu_25 add more info (see edit history) Link to comment Share on other sites More sharing options...
silviu_25 Posted January 10, 2020 Author Share Posted January 10, 2020 any hint ? Link to comment Share on other sites More sharing options...
Mund Posted January 20, 2022 Share Posted January 20, 2022 Yuo have to add new rewrite rules as: RewriteCond %{HTTP_HOST} ^cdn.mydomain.com$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}/p/$1/$1$2$3.jpg [L] or select cdn.mydomain.com to root folder, not to img and after regenerating .htaccess you have: RewriteCond %{HTTP_HOST} ^cdn.mydomain.com$ [OR] %{HTTP_HOST} ^mydomain.com$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}/img/p/$1/$1$2$3.jpg [L] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now