Home htaccess rewrite hotlinked image url to another url
Reply: 0

htaccess rewrite hotlinked image url to another url

WendiT
1#
WendiT Published in 2017-12-07 01:43:40Z

I'd like to replace the hotlinked images on my website with images that have a watermark.

The original image url is http://www.example.com/wp-content/uploads/an-image-name.jpg

I want to rewrite this to http://www.example.com/wp-content/uploads/an-image-name-wm.jpg

My thought is to include -wm to every image to show the watermarked version.

I have tried this with

### HOTLINK IMAGE ###
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomainnname.com [NC]
RewriteCond %{REQUEST_URI} ^/wp-content/uploads
RewriteCond %{REQUEST_URI} !-wm.jpg$
RewriteRule (.jpg)/?$ -wm$1 [L,NE,R]
### HOTLINK IMAGE ###

It works on http://htaccess.madewithlove.be/ but when I go to the hotlinking website that has my image on it, the image shows broken.

When I try to access the image direct I am redirected to http://www.mydomainnname.com/-wm.jpg

What is wrong with the script above?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.323281 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO