Created
December 15, 2012 14:05
-
-
Save jsawruk/4295348 to your computer and use it in GitHub Desktop.
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
//RewriteCond %{REQUEST_URI} !^/index\.php.* [NC] | |
//RewriteRule ^(.*)$ /index.php | |
//RewriteCond %{REQUEST_URI} ^/site [NC] | |
//RewriteRule site index.php | |
if ( isset($_SERVER['REDIRECT_URL']) ) { | |
// REDIRECT_URL - PHP_SELF | |
// http://localhost/test/ym/something/or/other?woot=1 | |
// '/test/ym/something/or/other' - '/test/index.php' | |
$path = $_SERVER['REDIRECT_URL']; | |
$find = $_SERVER['PHP_SELF']; | |
$pos = strrpos($find,'/'); | |
if ( $pos != '' ){ | |
$find = substr($find, 0, $pos); | |
$pos = strpos( $path, $find ); | |
$path = substr( $path, $pos+strlen($find) ); | |
} | |
} | |
elseif( isset($_SERVER['PATH_INFO']) ) { | |
// PATH_INFO | |
// http://localhost/test/index.php/ym/something/or/other?woot=1 | |
// '/ym/something/or/other' | |
$path = $_SERVER['PATH_INFO']; | |
} | |
else { | |
$path = ''; | |
} | |
$path = explode('/',ltrim($path,'/')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment