sibrodo Posted April 27, 2015 Share Posted April 27, 2015 (edited) Given the following full URL of my image: http://blitz.example.com.s3-website-ap-southeast-1.amazonaws.com/img/p/3/4/7/8/3478-product_list_default.jpg I would like to create a ReWriteRule on my .htaccess in such a way that i rewrite the the link below into the above URL:http://blitz.example.com.s3-website-ap-southeast-1.amazonaws.com/3478-product_list_default/green-army-combats-type-i.jpg This is my latest attempt of doing so, but still got no luck. Meaning the RewriteRule below generates the URL i mentioned above. RewriteCond %{HTTP_HOST} ^blitz.example.com.s3-ap-southeast-1.amazonaws.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] Can anyone help me with this ? Edited April 27, 2015 by sibrodo (see edit history) Link to comment Share on other sites More sharing options...
Dh42 Posted April 27, 2015 Share Posted April 27, 2015 What happens if you copy your prestashop htaccess over to your cdn? Link to comment Share on other sites More sharing options...
sibrodo Posted April 27, 2015 Author Share Posted April 27, 2015 (edited) @Dh42, i am using S3 as my CDN so i think it does not honor .htaccess file. I ended up trying using this in my .htaccess RewriteCond %{HTTP_HOST} ^blitz.example.com.s3-ap-southeast-1.amazonaws.com$ RewriteRule ^([0-9]+)([0-9]+)([0-9]+)([0-9]+)-([a-zA-Z0-9_\-/.]+)$ blitz.example.com.s3-ap-southeast-1.amazonaws.com/img/p/$1/$2/$3/$4/$1$2$3$4-$5.j$ The given Regex is valid against this: 3478-product_list_default/green-army-combats-type-i.jpg and can be verified here: http://regexr.com/3at3b The problem is simple yet so complex, basically i want to use the following URL: http://blitz.example.com.s3-website-ap-southeast-1.amazonaws.com/3478-product_list_default/green-army-combats-type-i.jpg so that it rewrites to: http://blitz.example.com.s3-ap-southeast-1.amazonaws.com/img/p/3/4/7/8/3478-product_list_default.jpg Edited April 27, 2015 by sibrodo (see edit history) Link to comment Share on other sites More sharing options...
sibrodo Posted April 27, 2015 Author Share Posted April 27, 2015 (edited) I just learned that the following RewriteRule (desipite it is valid), will yields an Server Error 404 RewriteCond %{HTTP_HOST} ^blitz.example.com.s3-ap-southeast-1.amazonaws.com$ RewriteRule ^(.*)([0-9]+)([0-9]+)([0-9]+)([0-9]+)-([a-zA-Z0-9_\-/.]+)/([a-zA-Z0-9_\-/.]+)$ img/p/$2/$3/$4/$5/$2$3$4$5-$6.jpg [L] Edited April 27, 2015 by sibrodo (see edit history) 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