| 2:03 am on Jan 7, 2009 (gmt 0)|
The answer depends on whether the link to the "developer image" in the code refers to an image on your own site, or on theirs. If it refers to their site, then you can't use mod_rewrite to fix this, although if you're on Apache 2.x, you might be able to set up an 'output filter' to catch the page content as it's being sent out from your server, and change it there.
Otherwise, the code will be identical to the anti-hotlinking code you can find here, except that you should remove the RewriteCond that checks the referrer, as it won't be needed.
| 2:18 am on Jan 7, 2009 (gmt 0)|
They send the images to my server when doing their auto-update, so then I presume I need only to use the anti-hotlinking code without the REFERRER section.
BTW - where is the anti-hotlinking code you mentioned? Do I just search for it, or was there supposed to be a link in your reply?
| 2:23 am on Jan 7, 2009 (gmt 0)|
Would this be it?
RewriteCond [mydomain...] [mydomain...] [L]
| 11:33 am on Jan 7, 2009 (gmt 0)|
No, you're matching against a local filepath in in per-directory context. That is r->filename (full physical path like /var/www/foo) with the striped directory prefix (if in /var/www/.htaccess, result is foo).
RewriteRule ^their\.gif$ my.gif [L]
| 1:13 pm on Jan 7, 2009 (gmt 0)|
| 3:01 pm on Jan 7, 2009 (gmt 0)|
Well-explained in the Apache mod_rewrite documentation. Highly-recommended.
| 3:33 pm on Jan 7, 2009 (gmt 0)|
| 3:51 pm on Jan 7, 2009 (gmt 0)|
I didn't understand that. It was WAY over my head.
But, using your advice as the search term, I did find an explanation at [yourhtmlsource.com...] which allowed me to understand the response from Caterham.
Thanks to both. Sorry for being so thick. I think whatever search term I was using in Google was giving me too many results and muddying the waters.
Cheers to both.
| 7:45 pm on Jan 7, 2009 (gmt 0)|
Post your example code to be sure you have the right version. :-)
| 8:01 pm on Jan 7, 2009 (gmt 0)|
So happy! It's working on the server.
Only question is, do I need the backslash before the dash in the second image filename?
RewriteRule ^theirimage\.gif$ myimage.gif [L]
RewriteRule ^theirheader\-repeat\.gif$ myheader-repeat.gif [L]
| 8:32 pm on Jan 7, 2009 (gmt 0)|
You don't need to escape either hyphen in that line. Only the regular expressions anchors, character-tokens, operators, and quantifiers need to be escaped with a backslash. See the regex tutorial cited in our Charter.
Also, suggest you fix the casing of "RewriteEngine on", although it will work as-is on *almost* all servers.
| 9:02 pm on Jan 7, 2009 (gmt 0)|
Oops. Hadn't even noticed the E.
It's working, but will fix.
Where do I find the Charter?
| 9:59 pm on Jan 7, 2009 (gmt 0)|
Thanks for posting it.
Even code that "works" isn't always "right". :-)