diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2011-05-06 22:48:09 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2011-05-06 22:48:09 -0400 |
commit | 8bd9d1519eee62660c395333a764a5d7443b85e2 (patch) | |
tree | cb505b1eb95f0731ecbcb1e248f65406b31aabaa /web/redirect.php | |
parent | Polishing... (diff) | |
download | PhotoFloat-8bd9d1519eee62660c395333a764a5d7443b85e2.tar.xz PhotoFloat-8bd9d1519eee62660c395333a764a5d7443b85e2.zip |
LIl things.
Diffstat (limited to 'web/redirect.php')
-rw-r--r-- | web/redirect.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/web/redirect.php b/web/redirect.php index d291fb6..06a2561 100644 --- a/web/redirect.php +++ b/web/redirect.php @@ -4,7 +4,7 @@ function cachePath($path) { $path = substr($path, 1); if ($path[strlen($path) - 1] == '/') $path = substr($path, 0, strlen($path) - 1); - $path = str_replace('_-_', '-', str_replace('/', '-', str_replace(' ', '_', str_replace('(', '', str_replace(')', '', str_replace('#', '', str_replace('[', '', str_replace(']', '', str_replace('"', '', str_replace("'", '', strtolower($path))))))))))); + $path = str_replace('_-_', '-', str_replace('/', '-', str_replace(' ', '_', str_replace('(', '', str_replace(')', '', str_replace('#', '', str_replace('[', '', str_replace(']', '', str_replace('&', '', str_replace(',', '', str_replace('"', '', str_replace("'", '', strtolower($path))))))))))))); while (strpos($path, "--") !== false) $path = str_replace("--", "-", $path); while (strpos($path, "__") !== false) @@ -23,9 +23,13 @@ if (strpos(strtolower($url), ".php") == strlen($url) - 4) { $url = substr($url, 0, strlen($url) - 4); $index = strrpos($url, "/"); $redirect = "/#".cachePath(substr($url, 0, $index))."/".cachePath(substr($url, $index)); +} else if (strpos($url, "/cache/") === 0 || strpos($url, "/albums/") === 0 || strpos($url, "/img/") === 0 || strpos($url, "/img/") === 0 || strpos($url, "/js/") === 0 || strpos($url, "/css/") === 0) { + header("HTTP/1.1 404 Not Found"); + exit(); } else $redirect = "/#".cachePath($url); - + +header("HTTP/1.1 301 Moved Permanently"); header("Location: $redirect"); ?>
\ No newline at end of file |