In your .htaccess file, add the following code:

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule (.*) index.php [L]

Now create an index.php with the following script:

<!DOCTYPE html>

<head>

<!– HEAD SCRIPTS, STYLES, ETC.. HERE —>

</head>

<body>

<?php

//FUNCTION FOR GETTING PAGE

function parseURI(){

//DEFAULT VALUE – SET TO LOGIN PAGE WHICH LOADS LOGIN.PHP

$retval = ‘login’;

$uri = $_SERVER[‘REQUEST_URI’];

 

if($uri !== ”){

    $uri = explode(‘/’,$uri);

    $length = count($uri);

    if(isset($uri[$length – 1])){

        $retval = $uri[$length – 1];

    }

}   

return $retval;

 

}

 

$currentUri = parseURI();

$file = $currentUri.”.php”;

 

//SEE IF FILE EXISTS

if(file_exists($currentUri.”.php”)){

//IF SO REQUIRE IT

require($currentUri.”.php”);

}else{

//OTHERWISE GO TO LOGIN

require(“login.php”);

}

?>

 

</body>

</html>