I moved my images directory to another folder, and today I wish to redirect all images demands from that folder towards the brand new one. I actually do not need the primary configuraion file, so I am carrying this out inside a .htaccess.

I attempted this, and delay pills work:

RewriteCond %{REQUEST_URI} old_dir/.+\.(jpg|png|gif)$

RewriteRule old_dir/(.+[^/]+\..+)$ $1 [L,PT]

Consider they've permanently moved, I wish to perform a proper redirect, and so i added the [R] flag, such as this:

RewriteCond %{REQUEST_URI} old_dir/.+\.(jpg|png|gif)$

RewriteRule old_dir/(.+[^/]+\..+)$ $1 [L,PT,R]

However the server will get confused, and returns a 400, and so i checked out the log file, which is what goes on:

strip per-dir prefix: C:/wamp/www/natrazyle/old_dir/images/banner.jpg -> old_dir/images/banner.jpg

applying pattern 'old_dir/(.+[^/]+\..+)$' to uri 'old_dir/images/banner.jpg'

rewrite 'old_dir/images/banner.jpg' -> 'images/banner.jpg'

add per-dir prefix: images/banner.jpg -> C:/wamp/www/natrazyle/images/banner.jpg

explicitly forcing redirect with http://localhost/C:/wamp/www/natrazyle/images/banner.jpg

As you can tell, the entire local path will get added after localhost

I understand I am doing a problem, I simply can't decipher it myself. Any help could be greatly appreciated...

Make use of an absolute URL path inside your substitution:

RewriteRule ^old_dir/(.+\.(jpg|png|gif))$ /$1 [L,R]