I just made a small bugfix to my .favicon to PNG script, but thought it would be a better idea to put this somewhere better than a static web page.
So I’ve moved it over to GitHub where anyone can play with it, hopefully it will be more useful there.
Ever want to add a link to a site with the favourites icon in the page along with the link? I did, so I made this cool little toy:
I’ve noticed that most of the traffic to this site is actually people visiting my permanent and temporary file dumps, which until today were literally a bunch of files dumped in a folder. DreamHost don’t keep my logs for over 30 days and I’d like to incorporate my file dumps into my Piwik stats, so I made a nice fancy file list in PHP. It has nice looking icons courtesy of famfamfam, though may move to stdicon in the future.
- The file list currently tracks directory views (via the template) but not yet file downloads, as that requires a Piwik plugin that isn’t final so I haven’t installed it, adding it should be trivial though.
- As requests are passed through PHP using mod_rewrite it will result in long running scripts on your server, which may upset your shared web hosting provider.
- Scripts are not yet excluded by rewrite rules! You won’t want to keep other scripts containing sensitive information in dirs under the path.
- Access to files and folders beginning with “.” will be blocked.
- It only works on Unices, not Windows servers as they don’t have the “file” command to get the MIME type.
- You’ll obviously need an Apache installation with mod_rewrite.
To install it, just copy index.php, .htaccess and .filelist/ to the directory where you store your files. You can get the script (without icons) from SVN.
If you do a Google search for some of my really old code, like my Python T9 Dictionary or XBMC IRC MP3 downloader, you’ll notice that my pagerank has been carried over to SVN and the gallery. This is because Google and other search engines take note of HTTP 301 response codes and update their links accordingly.
When I migrated from e107 to WordPress and Gallery2, I replaced download.php with a redirect script which redirects to the gallery, svn or file dumps. The script looks like this:
// lots excluded
$address = 'http://bitplane.net/';
foreach ($_GET as $i => $value)
$index = explode('_', $i);
if ( isset($index) && isset( $table[ $index ]) )
$address = $table[ $index ];
// send 301 (permanent redirect)
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $address );
This file has permanently moved <a href="<? echo $address; ?>">here</a>
So when you try to view PY9, you’re redirected to the new location. There’s no excuse for 404 errors when you move your site around, if you care about keeping the web up-to-date then please use a redirect script!