The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!
function stripstuff( $string )
{
$string = str_replace ( '/', '', $string );
$string = split ( '[?]', $string );
strtolower(trim($string[0]));
return $string[0];
}
$theFile = $_SERVER["REQUEST_URI"];
if ($theFile == "/" || $theFile == "")
{
// If nothing redirect to home page
header('Location: index.php');
}
else
{
$theFile2 = stripstuff($theFile);
query database for matching string
if ($num_rows > '0')
{
while ($rowID = mysql_fetch_array($result))
{
$ArticleCkID = $rowID['ArticleID'];
}
}
else
{
header('Location: site-map.php');
}
function stripstuff( $string )
{
$string = str_replace ( '/', '', $string );
$string = split ( '[?]', $string );
strtolower(trim($string[0]));
return $string[0];
}
$theFile = $_SERVER["REQUEST_URI"];
if ($debug) { echo "URI = " . $_SERVER["REQUEST_URI"] . "<br />"; }
if ($theFile == "/" || $theFile == "")
<?php // 404handler.php
error_reporting(E_ALL);
if (isset($_SERVER["REQUEST_URI"]))
{
// IF A PHP SCRIPT IS NOT FOUND GO TO THE HOME PAGE
if (preg_match('#\.php#i', $_SERVER["REQUEST_URI"]))
{
header('Location: /');
exit;
}
// IF A NON-PHP SCRIPT IS NOT FOUND, TRY IT WITH PHP
$arr = explode('?', $_SERVER["REQUEST_URI"]);
$arr[0] .= '.php';
$uri = implode('?', $arr);
header("Location: $uri");
exit;
}
// IF NO REQUEST URI
header('Location: /');
exit;
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.