Last active
October 6, 2017 09:31
-
-
Save Caffe1neAdd1ct/730144309e4a9d18d8ae10ef53430521 to your computer and use it in GitHub Desktop.
Router for CakePHP 1.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); | |
// If the file exists then return false and let the server handle it | |
if (file_exists($_SERVER["DOCUMENT_ROOT"] . $path)) { | |
return false; | |
} else { | |
/** makes the /manage/ area work */ | |
if ($_SERVER["SCRIPT_FILENAME"] === $_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'index.php') { | |
$_SERVER['SCRIPT_NAME'] = '/'; | |
$_SERVER['PHP_SELF'] = '/'; | |
require_once 'index.php'; | |
} else { | |
/** makes cakephp plugin asset loading work */ | |
if (!strpos($_SERVER['SCRIPT_NAME'], '/index.php')) { | |
$_SERVER['SCRIPT_NAME'] = "/index.php" . $_SERVER['SCRIPT_NAME']; | |
} | |
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; | |
$_SERVER['PHP_SELF'] = ''; | |
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['SCRIPT_NAME']; | |
require 'index.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment