views:

113

answers:

3

Hi,

I'm trying to figure out how to use mod_rewrite so that I can replace linked images (coming in externally) and use local ones instead.

Why am I doing this? I have a plugin which I'm integrating into my site, which uses ugly external images as buttons, and I want to redo these buttons to match my site. The links come in externally and are not embedded in a plugin php somewhere, so I figure there might be some way of using mod_rewrite to intercept and replace the incoming links.

I hope someone can help, thanks!

A: 

I'm not sure I fully understand your question but it seems like you are saying that you have some third-party code running on your site that references images on another domain, and you would like to replace those images with other images that are hosted on your domain.

If that's a correct description of the problem, then mod_rewrite is not able to do what you want. mod_rewrite can only affect requests to your web server. If your server gives out HTML that refers to images hosted on another domain, the user's browser is going to go directly to the web server for that other domain to get those images, and your server will never see those requests.

What you really need to do is to change the third-party code to generate the image URLs that you want in the first place.

If this does not describe your problem, then please try to clarify the question.

Tyler McHenry
And here I was thinking I was clear. :) But you read through my jibberish and got the point anyways! So mod_rewrite can't do this. hmm. I'm integrating Disqus into my wordpress blog and I'm trying to figure out how to replace their button images. None of the php plugin code has reference to the images, so it's being generated from Disqus and pulled into my blog as far as I can tell. That being the case, is there any way that you know of that I might be able to do this?
A: 

If you really want to approach this problem from this direction, you should look at mod_proxy_html.

Zed
A: 

there's a plugin for this

cognaccola