Sure it might be possible to do a redirect on the Bootstrap file (index.php for example) with the combination of strtolower
, stristr()
, str_replace()
and header()
Functions like so:
<?php
// ASSUMING THE BASE URI IS KNOWN
$baseURI = "http://www.my-domain.com";
// CONVERT ALL CHARACTERS IN THE $_SERVER['REQUEST_URI'] TO LOWER-CASES
$uri = strtolower($_SERVER['REQUEST_URI']);
$rdURI = str_replace("homepage", "homePage", $uri);
// USE EITHER A SWITCH OR IF CONDITIONAL LOGIC TO SET THE URI
if(stristr($uri, "homepage")){ // REDIRECT ANY THING WITH HOMEPAGE TO: homePage
$rdURI = str_replace("homepage", "homePage", $uri);
}else if(stristr($uri, "another-uri-1")){
$rdURI = str_replace("another-uri-1", "another-URI-1", $uri);
}else if(stristr($uri, "another-uri-2")){
$rdURI = str_replace("another-uri-2", "another-URI-2", $uri);
}else if(stristr($uri, "yet-another-uri")){
$rdURI = str_replace("yet-another-uri", "yet-Another-URI", $uri);
}else{
// DEFAULT TO THE HOMEPAGE IF ALL ELSE FAIL
// THIS DECISION IS UP TO YOU AS YOU MIGHT NOT NEED IT TO WORK THIS WAY...
$rdURI = str_replace("homepage", "homePage", $uri);
}
// REDIRECT TO THE NEW URI...
header("location: " . $rdURI);
exit;
// OR REDIRECT TO THE NEW URI WITH BASE URI...
header("location: " . $baseURI . DIRECTORY_SEPARATOR . $rdURI);
exit;