.htaccess redirect question

How would I redirect a specific url for a .jpg like http://www.realweatherstation.com/wxs/stickerx.jpg to a .php file e.g. http://www.realweatherstation.com/wxs/stickerx.php ?

Why redirect? Is it not an option just to change the original jpg-url to the php-url in your page? It should show the picture anyhow.

Well if it is referred to by web sites Niko does not own then renaming is not the solution.

Niko does this help at all? I think a standard redirect should work… but I’ve not tested it… I think redirects would be done before any server processing I thi nk it should work. As always YMMV… :wink: :wink:


Here’s what I use in a .htaccess for that

Redirect /sig.gif http://saratoga-weather.org/wxsticker/sticker.php?type=sig
Redirect /banner.gif http://saratoga-weather.org/wxsticker/sticker.php?type=banner
Redirect /banner_big.gif http://saratoga-weather.org/wxsticker/sticker.php?type=banner_big

Hope this helps…
Best regards,

Thank you everyone, Ken’s code is exactly what I was looking for :smiley:

Update: Unfortunately it appears that the particular Invision board can’t be fooled into a live linked avatar or .sig image. Even if you give it a .gif URL for the image it uploads and stores it instead of linking to it :frowning:

I use RewriteRule rather than redirect:

RewriteRule    carsewx1.jpg      http://www.carseweather.co.uk/mypath/wxgraphic.php?type=banner

this assumes that you have previously set “RewriteEngine on”


Thanks Chris, another good option :slight_smile:

Both methods work. The functional difference is that Redirect will change the displayed URL to the target URL, while RewriteRule will continue to display the original URL.

This URL has a Redirect


This URL has a RewriteRule