Forums
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
You aren’t giving me much to work with.
Try debugging yourself by placing echos and var_dumps on crucial places (where things might go wrong) so you know where and why things go wrong. I recommend `var_dump($page)` right before your switch since that seems to be the problem.
I think I may just go ahead and handle the error page through .htaccess
Hi there
I have a solution to your problem:
In your .htaccess file ensure you have the following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L,QSA]
Then go to your index.php and add the following:
list($path) = explode('?', $_SERVER);
//Remove script path:
$path = substr($path, strlen(dirname($_SERVER))+1);
//Explode path to directories and remove empty items:
$pathInfo = array();
foreach (explode('/', $path) as $dir)
{
if (!empty($dir))
{
$pathInfo[] = urldecode($dir);
}
}
if (count($pathInfo) > 0)
{
//Remove file extension from the last element:
$last = $pathInfo[count($pathInfo)-1];
list($last) = explode('.', $last);
$pathInfo[count($pathInfo)-1] = $last;
}
Do a print_r on $pathInfo will show you everything within the URL
Now you make all your URLS point:
http://localhost/
Sorry the above should be: