Your IP : 172.70.178.32


Current Path : /var/www/element/data/www/vsl-gates.ru/
Upload File :
Current File : /var/www/element/data/www/vsl-gates.ru/demis-url-rewriter.php

<?php
// Раздел настройки ЧПУ (Все пути начинаются с ведущего слеша от корневой директории)
/*  $aURLRewriter = array (
    '/shop/CID_432.html' => '/shop/depilyaciya_voskom_v_domashnih_usloviyah.html',
    '/shop/CID_406.html' => '/shop/nitratomer_bytovoy.html',
    '/shop/CID_350.html' => '/shop/elektroprostyni.html',
    '/shop/CID_347.html' => '/shop/elektrogrelki.html',
    '/shop/CID_336.html' => '/shop/lechebnye_ochki_trenazhery.html',
    '/shop/CID_424.html' => '/shop/sterilizator_manikyurnyh_instrumentov.html',
    '/shop/CID_430.html' => '/shop/nabor_dlya_parafinoterapii_v_domashnih_usloviyah.html',
    '/shop/CID_364.html' => '/shop/valiki_lyapko.html',
    '/shop/CID_420.html' => '/shop/massazher_dlya_nog.html',
  );
*/






// Раздел обработки
//  $aURFlip = array_flip($aURLRewriter);

/*  function durRewrite ($sURL) {
    global $REQUEST_URI, $REDIRECT_URL;
    $_SERVER['REDIRECT_URL'] = $sURL;
    $_SERVER['REQUEST_URI'] = $sURL;
    $REQUEST_URI = $sURL;
    $REDIRECT_URL = $sURL;
    if (preg_match_all('%[\?&]([^\=]+)\=([^&]+)%siU', $sURL, $aM)) {
      foreach ($aM[1] as $iKey => $sName) {
        $_GET[$sName] = $aM[2][$iKey];
      }
    }
  }

  function durIFRewrite () {
    global $aURFlip, $aURLRewriter;
    if (isset($aURFlip[$_SERVER['REQUEST_URI']])) {
      durRewrite ($aURFlip[$_SERVER['REQUEST_URI']]);
    }
  }

  function durR301 () {
    global $aURFlip, $aURLRewriter;
    if (isset($aURLRewriter[$_SERVER['REQUEST_URI']])) {
      header('HTTP/1.1 301 Moved Permanently');
      header('Location: ' . $aURLRewriter[$_SERVER['REQUEST_URI']]);
      exit;
    }
  }

  function durLinkChanger ($sContent) {
    global $aURFlip, $aURLRewriter, $bDURDebug;
    $sBase = preg_replace('%^(.*)(/[^/]*)?$%siU', '$1', $_SERVER['REQUEST_URI']);
    foreach ($aURLRewriter as $sFrom => $sTo) {
      $sFrom = trim($sFrom, '/')."/";
      $sTo = trim($sTo, '/')."/";
      $sContent = str_replace ($sFrom, $sTo, $sContent);
    }
    if ($bDURDebug) {
      $sContent .= "<!--\nSERVER:" . print_r($_SERVER, true) . "\n\nGET:" . print_r($_GET, true) . "\n-->";
    }
    return $sContent;
  }
*/


/*

// Demis CHPU --- (Smoke 09.07.2010)
  if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/demis-url-rewriter.php')) {
    $bDURDebug = false;
    include_once($_SERVER['DOCUMENT_ROOT'] . '/demis-url-rewriter.php');
  }
  if (isset($aURLRewriter)) {
  // Redirect 301
    durR301();
  // Rewrite URL
    durIFRewrite();
  }
  ob_start();
// --- Demis CHPU


...........

// Demis CHPU --- (Smoke 09.07.2010)
$sContent = ob_get_clean();
$sContent = durLinkChanger ($sContent);
echo $sContent; 
// --- Demis CHPU

*/
?>