This content was deleted.

'); } function notfound() { header('HTTP/1.0 404 Not Found'); die(' Not found

This was not found.

Please search for it instead.

'); } function maybe_redirect($uri) { if (file_exists("./$uri/index.html")) { redirect_to($uri); } } $redirects = array( {% for (from, to) in redirects %} "{{ from }}" => "{{ to }}", {%- endfor -%} ); $gone = array( {% for gone in gones %} "{{ gone }}" => true, {%- endfor -%} ); $uri = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); $uri = str_replace('../', '', $uri); $uri = str_replace('/feed/', '', $uri); $uri = str_replace('/atom/', '', $uri); $uri = trim($uri, '/'); if (isset($gone[$uri])) gone($uri); elseif (isset($redirects[$uri])) redirect_to($redirects[$uri]); // replace _ with - and look for a file elseif (strstr($uri, '_')) maybe_redirect(str_replace('_', '-', $uri)); // try getting rid of -by-xyz elseif (stristr($uri,'-by-')) maybe_redirect(preg_replace('/(.*?)-by-.*$/i','${1}',$uri)); // try getting rid of -2, WordPress artifacts elseif (stristr($uri,'-2')) maybe_redirect(preg_replace('/(.*?)-2$/i','${1}',$uri)); else notfound();