More 404 work. Hopefully fixes #1471

git-svn-id: https://develop.svn.wordpress.org/trunk@3111 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-11-16 22:54:52 +00:00
parent faa7e8cbdd
commit ee98b26ac0
1 changed files with 60 additions and 66 deletions

View File

@ -1412,29 +1412,22 @@ class WP {
$extra_query_vars = array();
// Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
if ((isset($_GET['error']) && $_GET['error'] == '404') ||
((! empty($_SERVER['PATH_INFO'])) &&
('/' != $_SERVER['PATH_INFO']) &&
(false === strpos($_SERVER['PATH_INFO'], '.php'))
) ||
(false === strpos($_SERVER['REQUEST_URI'], '.php'))
) {
$this->did_permalink = true;
// If we match a rewrite rule, this will be cleared.
$error = '404';
// Fetch the rewrite rules.
$rewrite = $wp_rewrite->wp_rewrite_rules();
if (! empty($rewrite)) {
// If we match a rewrite rule, this will be cleared.
$error = '404';
$this->did_permalink = true;
$pathinfo = $_SERVER['PATH_INFO'];
$pathinfo_array = explode('?', $pathinfo);
$pathinfo = $pathinfo_array[0];
$req_uri = $_SERVER['REQUEST_URI'];
$req_uri_array = explode('?', $req_uri);
$req_uri = $req_uri_array[0];
$self = $_SERVER['PHP_SELF'];
$home_path = parse_url(get_settings('home'));
$home_path = $home_path['path'];
@ -1446,6 +1439,8 @@ class WP {
$req_uri = str_replace($home_path, '', $req_uri);
$req_uri = trim($req_uri, '/');
$pathinfo = trim($pathinfo, '/');
$self = str_replace($home_path, '', $self);
$self = trim($self, '/');
// The requested permalink is in $pathinfo for path info requests and
// $req_uri for other requests.
@ -1489,8 +1484,8 @@ class WP {
}
}
// If req_uri is empty, the home page was requested. Unset error.
if ( empty($req_uri) ) {
// If req_uri is empty or if it is a request for ourself, unset error.
if ( empty($request) || $req_uri == $self ) {
if (isset($_GET['error'])) {
unset($_GET['error']);
}
@ -1500,7 +1495,6 @@ class WP {
}
}
}
}
$this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);