.htaccess
RewriteEngine On
#accept loading of actual files and directories (folder and file milcha bhanay exactly tehe load garnay)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#send everything else to index page
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
index.php (just for core test)
<?php
function printer($obj){
echo ‘<pre>’;
print_r($obj);
echo ‘</pre>’;
}
function splitURL(){
$url = $_GET[‘url’] ?? ‘home’; // $url is home if ‘url’ is null or not set
$url = explode(‘/’,$url);
return $url;
// printer($url);
}
// printer(splitUrl());
function loadController(){
$url = splitURL();
$filename = “../app/controllers/”.ucfirst($url[0]).”.php”;
if(file_exists($filename)){
require_once $filename;
}else{
echo “controller not found”;
}
}
loadController();
robots.txt
User-agent:*
Disallow: /admin/
Disallow: /ajax/