Welcome to WebmasterWorld Guest from 34.204.176.189

Forum Moderators: phranque

Message Too Old, No Replies

Serving GIF as a JPG

     
10:07 pm on Nov 15, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 2, 2006
posts: 82
votes: 0



Hi, hope this is the proper forum,
Im really not sure how this might be done.

I have a JPG banner hosted on my site for hotlinking and would like to replace it with an animated GIF keeping all the links active with the JPG extension.

Is that possible through .htaccess or something?

Thanks

5:09 am on Nov 16, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11823
votes: 237


something like this might work to internally rewrite all /path/to/file.name.jpg to /path/to/file.name.gif:
Options +FollowSymLinks
RewriteEngine on
#
# internally rewrite .jp(e)g to equivalent .gif
RewriteRule ^(.*)\.jpe?g$ $1.gif [L]

you would normally prefer not to use the ambiguous, greedy and promiscuous '.*' in your regexp, but i didn't see a good way out of this one.

12:09 am on Nov 19, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 2, 2006
posts: 82
votes: 0



Hey thanks,
it's actually only a single file I need to do this with so I assume I can just put the filename in and not even use wildcards.
2:16 pm on Nov 19, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11823
votes: 237


you definitely want to be as specific as possible with your regular expression.
maybe like:
RewriteRule ^banner.jpg$ animated.gif [L]
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members