Clean URL

<?php

$urlArray = explode("/",$_SERVER["REQUEST_URI"]);
$url_what = $urlArray[count($urlArray)-1];

if($url_what == 'home') {
// rather than index.php?act=home, url would be index/home
displayHome();
}elseif($url_what == 'contact'){
// rather than index.php?act=contact,url will be index/contact
displayContact();
}elseif($url_what == 'calendar'){
// rather than index.php?act=calendar,url will be index/calendar
displayCalendar();
}elseif($url_what == 'about'){
// rather than index.php?act=about,url will be index/about
displayAbout();
}else
//if $url_what doesn't exist, display home
writeHome();

?>

source

Leave a Reply