How can I use mod_rewrite to send requests for a particular file type to another domain name (server)?
Example:
If you request http://example.com/potato.png
then it'll redirect to http://anotherdomain.com/potato.png
.
Here's a quick solution to redirect images with jpg, gif or png extension to anotherdomain.com
RewriteEngine on
RewriteRule \.(gif|jpg|png)$ http://anotherdomain.com/%{REQUEST_URI} [NC,R=301,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With