Created
May 9, 2013 15:17
-
-
Save rianrainey/5548113 to your computer and use it in GitHub Desktop.
Run Wordpress using PHP 5.4's built-in server. This is an attempt to get routing working with Wordpress using PHP 5.4. It works for the non-admin pages. I'm still working on getting it working for Admin pages. It just doesn't reference the CSS properly.
This file contains 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 | |
$root = $_SERVER['DOCUMENT_ROOT']; | |
chdir($root); | |
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/'); | |
set_include_path(get_include_path().':'.__DIR__); | |
if(file_exists($root.$path)) | |
{ | |
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/') | |
$path = rtrim($path,'/').'/index.php'; | |
if(strpos($path,'.php') === false) return false; | |
else { | |
chdir(dirname($root.$path)); | |
require_once $root.$rootpath; | |
} | |
}else include_once 'index.php'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment