function shCheckRedirect ($dest, $incomingUrl) {

  $sefConfig = & Sh404sefFactory::getConfig();
  if (!empty($dest) && $dest != $incomingUrl) {
    // redirect to alias
    if ($dest == sh404SEF_HOMEPAGE_CODE) {
      if (!empty($sefConfig->shForcedHomePage)) {
        $dest = shFinalizeURL($sefConfig->shForcedHomePage);
      } else {
        $dest = shFinalizeURL(Sh404sefFactory::getPageInfo()->getDefaultLiveSite());
      }
    } else {
      $shUri = new JURI($dest);
      $shOriginalUri = clone( $shUri);
      $dest = shSefRelToAbs($dest, '', $shUri, $shOriginalUri) . $shUri->toString( array('query'));
    }
     
    if ($dest != $incomingUrl) {
      _log('Redirecting to '. $dest .' from alias '.$incomingUrl);
      shRedirect($dest);
    }
  }
}
Exemple #2
0
function shCheckRedirect($dest, $incomingUrl)
{
    $sefConfig =& shRouter::shGetConfig();
    if (!empty($dest) && $dest != $incomingUrl) {
        // redirect to alias
        if ($dest == sh404SEF_HOMEPAGE_CODE) {
            if (!empty($sefConfig->shForcedHomePage)) {
                $dest = shFinalizeURL($sefConfig->shForcedHomePage);
            } else {
                $dest = shFinalizeURL($GLOBALS['shConfigLiveSite']);
            }
        } else {
            $shUri = new JURI($dest);
            $shOriginalUri = clone $shUri;
            $dest = shSefRelToAbs($dest, '', $shUri, $shOriginalUri) . $shUri->toString(array('query'));
        }
        if ($dest != $incomingUrl) {
            _log('Redirecting to ' . $dest . ' from alias ' . $incomingUrl);
            shRedirect($dest);
        }
    }
}
Exemple #3
0
     if ($shTemp == $shMosConfig_locale) {
         $shTemp = '';
     } else {
         $shTemp = $shLang;
     }
 } else {
     $shTemp = '';
 }
 $shAnchor = empty($shPageInfo->URI->anchor) ? '' : '#' . $shPageInfo->URI->anchor;
 if (!empty($sefConfig->shForcedHomePage)) {
     // V 1.2.4.t
     $shTmp = $shTemp . $shAnchor;
     $dest = shFinalizeURL($sefConfig->shForcedHomePage . (empty($shTmp) ? '' : '/' . $shTmp));
 } else {
     $shRewriteBit = empty($shTemp) ? '/' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode];
     $dest = shFinalizeURL($GLOBALS['shConfigLiveSite'] . $shRewriteBit . $shTemp . $shAnchor);
 }
 _log('Redirection calculated as ' . $dest);
 if (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) {
     // IIS adds index.php to $_SERVER['REQUEST_URI'], even if it
     // was not requested by visitor
     if (empty($sefConfig->shForcedHomePage)) {
         $target = str_replace('index.php', '', $shPageInfo->shSaveRequestURI);
         $target = str_replace('Index.php', '', $target);
         // sometimes IIS uses Index.php instead of index.php
         $current = $shPageInfo->URI->protocol . '://' . $shPageInfo->URI->host . (!sh404SEF_USE_NON_STANDARD_PORT || empty($shPageInfo->URI->port) ? '' : ':' . $shPageInfo->URI->port) . $target . $shAnchor;
     } else {
         $current = $dest;
         // if there is a splash page, we don't know what to do, so avoid infinite loop
     }
     _log(' IIS detected, $current calculated as : ' . $current);