Where does WP write headers?
-
Hey all,
I’m trying to figure out the best place to put the following piece of code, or how to best modify it:
if (is_404()) {
if (file_exists('/home/justpete/archive' . $_SERVER[REQUEST_URI])) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://archive.justpetehere.com" . $_SERVER[REQUEST_URI]);
exit();
}
}I just replaced my previous blog with WP, and decided to not import it, rather, just move it over to an “archive” hostname on the same server. This script checks if the file requested exists on the archive hostname, and if so, sends a 301 to redirect. I also want to have it check if somehow the page ALSO exists on the WP blog, so the if is_404 would be nice.
The problem is that I can’t figure out a place in the calls before PHP defines the header for the document.
Anyway, any ideas?
The topic ‘Where does WP write headers?’ is closed to new replies.