i have build a URL-Routing FrontController in PHP. All works fine, but now i find a error, if i have more params then 2 it dont works, for example:
This URL works:
"www.comelio.com/business-intelligence/anleser/"
but this URL dont works:
"www.comelio.com/business-intelligence/data-mining/anleser/"
My Rewrite Rule:
RewriteRule ^([\w-]+)/?([\w-]+)/?([\w-]+)/?([\w-]+)? index.php?lang=$1&rubrik=$2&unterrubrik=$3&seite=$4
Here my Routing if-else code:
if($seite == null) {
$filename = "{$rubrik}.html";
$xdmvalue = $saxonProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
}
} else if(isset($seite) && isset($rubrik)){
$filename = "{$rubrik}_{$seite}.html";
$xdmvalue = $saxonProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
}
} else if(isset($seite) && isset($rubrik) && ($unterrubrik)){
$filename = "{$rubrik}_{$unterrubrik}_{$seite}.html";
$xdmvalue = $saxonProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
}
}
Before i write this code so the second parameter works only, now only the third parameter works, for example now works:
"comelio.com/business-intelligence/data-mining/anleser"
And this dont works:
"comelio.com/business-intelligence/anleser"