Created
August 3, 2012 15:06
-
-
Save koko1000ban/3248440 to your computer and use it in GitHub Desktop.
router.php
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 | |
// htaccessのかわり | |
$real_file = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']; | |
if (file_exists($real_file)) { | |
return false; | |
} | |
if (!preg_match('/^\/(?:index\.php|images|robots\.txt)/', $_SERVER['REQUEST_URI'])) { | |
$redirect_url = 'http://' . $_SERVER['HTTP_HOST'] . "/index.php" . $_SERVER['REQUEST_URI']; | |
/* header("HTTP/1.1 301 Moved Permanently"); */ | |
header("HTTP/1.1 302 Found"); | |
header("Location: $redirect_url"); | |
exit(); | |
} else { | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment