I have a site that has lost some pages. I am trying to catch the strings in old url from search engines and redirict them to the new replacement page. I am not sure if I am going the right direction with my code. And I have a provlem with url's that are a directory deep.
Here is what I am using:
function stripstuff( $string )
$string = str_replace ( '/', '', $string );
$string = split ( '[?]', $string );
$theFile = $_SERVER["REQUEST_URI"];
if ($theFile == "/" || $theFile == "")
// If nothing redirect to home page
$theFile2 = stripstuff($theFile);
query database for matching string
if ($num_rows > '0')
while ($rowID = mysql_fetch_array($result))
$ArticleCkID = $rowID['ArticleID'];
I have 3 questions/issues:
1. Is this the best way to achieve this?
2. When there is a sub-folder (www.domain.com/articles/this-is-the-file.php
) the catch string has to be "articlesthis-is-the-file.
php" for it to find the proper file
3. It doesn't show images bacause it is not in the proper folder level.