Many forums don't allow the use of non-standard image extensions (NOT .jpg, .png, or .gif) in the signatures area for obvious safety reasons. I've been using the little PHP-based LastFM image seen in the top right corner of the header area on this blog in my signatures for quite some time without trouble.

Unfortunately, several websites have changed their forum systems a bit such that the .php extension is no longer recognized as a valid image file. This obviously sucks as it's really cool having your most recently played song visibile in your signature area. Rather than making a cron script to update an actual .png file every 5 minutes or so, I just decided to use some .htaccess redirect trickery to avoid the extension limitation. Basically, you will input an acceptable file extension into the forum's signature code area but the file you provided will redirect to the php image file.
First you need to find the .htaccess file in the directory where the desired .php file is located. If it's not there, just create it using your FTP client and then open it in a text editor. Copy in the following line of code:
Redirect ORIGINAL_FILE REDIRECT_FILE
Replace "ORIGINAL_FILE" with the path to the nonexistent .jpg, .png, or .gif file and "REDIRECT_FILE" with the path to the actual PHP-generated file. Both paths need to be full paths from the root directory of the visible website. For example, I'm running mine on my student server at UW so the following redirect code is used:
Redirect /csullend/recent.jpg /csullend/recent.php
I am providing the "recent.jpg" file as the fake file for the forums which redirects to the recent.php file. So what I use in the forums is the following link:
http://students.washington.edu/csullend/recent.jpg
The .htaccess file redirects the inbound traffic to recent.jpg (which doesn't even actually exist) to recent.php, thus tricking the forum's signature checker into accepting the .php extension file even though they aren't allowed.
Written by
Colin
on
12/25/2010
Tags:
lastfm,
web design,
website
Subscribe to:
Post Comments (Atom)

0 Comments:
Post a Comment