Hey bjorn I made a different approach to this issue and made a custom 404 handler to make this work.
Code:
<?php
$url="";
$server_location = $_SERVER["REQUEST_URI"];
$lval = split("/", $server_location);
$lval = $lval[count($lval)-1];
$sval = split("\?", $lval);
$querystring = $sval[1];
$origurl = $sval[0];
function left($str, $length) {
return substr($str, 0, $length);
}
function right($str, $length) {
return substr($str, -$length);
}
function instr($mainstr, $searchstr) {
if (strpos($mainstr, $searchstr) === false) { return false; } else { return true; }
}
function getID($type) {
global $origurl;
$id = substr($origurl, strpos($origurl, $type)+strlen($type), strpos($origurl, ".")-strpos($origurl, $type)-strlen($type)); /*fancy string work*/
return $id;
}
function getURL() {
global $origurl, $url;
if (instr($origurl, "-c-")) {
$id = getID("-c-");
$url="index.php?cPath=$id&$querystring";
}
if (instr($origurl, "-p-")) {
$id = getID("-p-");
$url="product_info.php?products_id=$id&$querystring";
}
if (instr($origurl, "-m-")) {
$id = getID("-m-");
$url="index.php?manufacturers_id=$id&$querystring";
}
if (instr($origurl, "-pi-")) {
$id = getID("-pi-");
$url="popup_image.php?pID=$id&$querystring";
}
if (instr($origurl, "-pri-")) {
$id = getID("-pri-");
$url="product_reviews_info.php?products_id=$id&$querystring";
}
if (instr($origurl, "-t-")) {
$id = getID("-t-");
$url="articles.php?tPath=$id&$querystring";
}
if (instr($origurl, "-a-")) {
$id = getID("-a-");
$url="article_info.php?articles_id=$id&$querystring";
}
if (instr($origurl, "-pr-")) {
$id = getID("-pr-");
$url="product_reviews.php?products_id=$id&$querystring";
}
if (instr($origurl, "-i-")) {
$id = getID("-i-");
$url="information.php?info_id=$id&$querystring";
}
if (instr($origurl, "-links-")) {
$id = getID("-links-");
$url="links.php?lPath=$id&$querystring";
}
}
getURL();
if ($url!="") {
$data = file_get_contents("yoursitehere.com/$url&skip_check=true");
echo $data;
} else {
echo "<center>Page cannot be found, if you feel you have gotten to this page by error please contact an admin [email protected]</center>";
}
?>
Modification in the seo code so you can skip the friendly redirect back to the 404 page.
Code:
// Ultimate SEO URLs v2.1
if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {
if ($_GET['skip_check']!=true) {
include_once(DIR_WS_CLASSES . 'seo.class.php');
if ( !is_object($seo_urls) ){
$seo_urls = new SEO_URL($languages_id);
}
}
}
hope this helps some of you on IIS out.