PHP Classes

File: goto

Recommend this page to a friend!
  Classes of Horst Nogajski   HN URL Rewrite   goto   Download  
File: goto
Role: Application script
Content type: text/plain
Description: this script handles the redirection
Class: HN URL Rewrite
Emulate request URL rewriting and redirection
Author: By
Last change: If no PATH_INFO is available (e.g. direct call of the file) it locates to the root-dir!
Date: 19 years ago
Size: 774 bytes
 

Contents

Class file image Download
<?PHP
/**
  * @author Horst Nogajski <horst@nogajski.de>
  * @copyright Copyright (c) 2001 - 2004
  *
  * @version 3.0
  *
  * Tabsize: 4
  *
  **/


    // redirect script, used in conjunction with php-class hn_urlRewrite

   
$root = (strrpos($_SERVER['DOCUMENT_ROOT'],'/')==strlen($_SERVER['DOCUMENT_ROOT'])-1) ? substr($_SERVER['DOCUMENT_ROOT'], 0, strlen($_SERVER['DOCUMENT_ROOT'])-1) : $_SERVER['DOCUMENT_ROOT'];
    require_once(
$root.'/hn_urlrewrite.class.php');


   
// calling a class_instance, if we have a pathinfo
   
if(isset($_SERVER['PATH_INFO']))
    {
       
$redirect =& new hn_urlRewrite();
       
$file = $redirect->redirect($_SERVER['PATH_INFO']);
        unset(
$redirect);
        require(
$file);
    }
    else
    {
       
header('Location: /');
        exit(
0);
    }

?>