JavaScript:
$(window).on('hashchange', function(){
var u = location.hash.replace('#/','');
if( u == '' ) return false;
$.ajax({
url: '/?src='+u, dataType: 'html', async: false,
success: function(html){ $('#content').html(html); }
});
});
И сам index.php файл:
if( empty($_GET['src']) ){ include 'template.php'; exit; }
$src = $_GET['src'];
while( $src[0] == '/' ) $src = substr( $src, 1, strlen($src) );
while( substr( $src, strlen($src)-1, 1 ) == '/' ) $src = substr( $src, 0, strlen($src)-1 );
$src = explode('/', $src);
$f = 'pages/'.$src[0].'.php';
if( is_file($f) ){ include $f; exit; } // file
include 'pages/404.php'; exit; // 404 not found