Reputation: 39
I have to set a rule on my htaccess file that redirects me all the images ex: img_4324_r.jpg to img_4324_s.jpg
all images
Upvotes: 0
Views: 30
Reputation: 868
For your exact example:
RewriteRule ^img_([0-9]+)_r\.jpg$ img_$1_s.jpg [R=301,L,NC]
if you have several extension with the same pattern:
RewriteRule ^img_([0-9]+)_r\.(jpe?g|png|gif)$ img_$1_s.$2 [R=301,L,NC]
Only to jpg:
RewriteRule ^img_([0-9]+)_r\.(jpe?g|png|gif)$ img_$1_s.jpg [R=301,L,NC]
You can repeat for each patterns if you have others, just capture what you need and use it
You also may need to add this at the top of you .htaccess:
RewriteEngine On
RewriteBase /
Upvotes: 1
Reputation: 728
RewriteRule ([^.]+\.(jpe?g|gif|bmp|png)) /img_4324_s.jpg [R=301,L,NC]
Should work, not 100% sure what you're asking for though.
Upvotes: 0