<?php
if (preg_match('/\.(?:png|jpg|jpeg|gif|pdf|xml)$/', $_SERVER["REQUEST_URI"]))
{
return false; // serve the requested resource as-is.
}
else if(preg_match("/(^|\/)./", $_SERVER["REQUEST_URI"]))
{
// Do your magic
$paths = explode('/',$_SERVER["REQUEST_URI"]);
if(isset($paths[1])) $_GET["page"] = $paths[1];
if(isset($paths[2])) $_GET["sub"] = $paths[2];
include("index.php");
}