for our product images...

I need to redirect the top url pattern to the bottom one for drupal:

original-> http://www.mydomain.com/store//images/P/image.jpg
new-> http://dev.mydomain.com/sites/default/files/images/imagecache/product/P/...

I tried this to no avail.
RewriteEngine on

RewriteCond %{HTTP_HOST}^.*/store//images/P/(.*)$ [NC]
RewriteRule ^.*/store//images/P/(.*)$ http://dev.mydomain.com/sites/default/files/images/imagecache/product/P/$1 [L,R=301]

anyone good with regex please help.
thanks in advance

Comments

briansea’s picture

The problem is: you're trying to match a URI in the HTTP_HOST - You need to match against the REQUEST_URI

This should do what you want:

RewriteCond %{REQUEST_URI} ^/store/images/P/(.*)
RewriteRule (.*) /sites/default/files/images/imagecache/product/P/%1 [L,R=301]