max
max

Reputation: 3716

rewriting images directory with htaccess

so here is the old address

http://sie.com/files/images/2013/12/600x415_img.jpg

note that all the image names are starting with 600x

also 2 directories before image 2013/12/ are dynamically created and can be different for other images depending on month/year

i want to redirect all these links to (all 600x images have been moved to new directory )

http://sie.com/thumbs/images/2013/12/600x415_img.jpg

basically replacing files with thumbs

this is what i have but it doesn't work

RewriteRule ^files/images/([0-9]*)/([0-9]*)/600x(.*)$ thumbs/images/$1/$2/600x$3[L]

here is my current htaccess

<IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /

    RewriteCond %{HTTP_HOST} ^img\.site\.com$ [NC]
    RewriteRule ^(images/.+)$ site.com/files/$1 [R=301,NC,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{ENV:REDIRECT_STATUS} ^$

    RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule>

Upvotes: 1

Views: 822

Answers (1)

ffflabs
ffflabs

Reputation: 17481

Can you try this?

RewriteRule ^files/images/(\d+)/(\d+)/600x(.*)$ /thumbs/images/$1/$2/600x$3 [L]

Upvotes: 1

Related Questions