RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
If you want to add the www to URLs check this out.
Natural Born Programmer
I have been extremely busy lately and I have totally neglected my blog over the last few months and I thought I would make a quick post.
A few weeks ago I participated on Charity Hack 2009 hosted by PayPal and sponsored by JustGiving and MissionFish with the aim to build an app in 24 hours over the weekend and overall after all hacks we won the second prize.
This functin will help to convert the Linux/Unix timestamp to human readable format:
<?php
function unix_timestamp_to_human ($timestamp = "", $format = 'D d M Y - H:i:s')
{
if (empty($timestamp) || ! is_numeric($timestamp)) $timestamp = time();
return ($timestamp) ? date($format, $timestamp) : date($format, $timestamp);
}
$unix_time = "1251208071";
echo unix_timestamp_to_human($unix_time); //Return: Tue 25 Aug 2009 - 14:47:51
?>
I had to cleanup a HTML created out of MS Word Document manually. Honestly it is a pain to manually search and replace all the junks Word Document generating. So I have written a text conversion function in PHP to automatically cleanup the MS Word junks and output HTML entities.