Wordpress (MU) doesn't consider $_SERVER['REDIRECT_URL']
|Reported by:||fmaz008||Owned by:|
I've a special case with a site using wordpress site only for specific part of it.
At the root of my site, I have the following /.htaccess file:
RewriteEngine On RewriteBase / RewriteRule ^bar/(.*)$ foo/bar/$1 [L]
The idea is that I want to emulate
Where /foo/ is the main wordpress MU installation, and /foo/bar/ is an additionnal site. Now the problem: if I access /bar/, I'll have the /foo/ site showing up, and tell me the bar article is not found.
The problem is that Wordpress only look out for REQUEST_URI, and never for REDIRECT_URL.
I can't figure out where is the exact route handler in wordpress, so I've not been able to make a full-fix yet, but for now, I think a part of the problem might reside in wp-includes/classes.php, WP::parse_request(), on line ~159:
$req_uri = $_SERVER['REQUEST_URI']; $req_uri_array = explode('?', $req_uri); $req_uri = $req_uri_array;
My fix suggestion would be to replace the previous code by the following:
$req_uri = $_SERVER['REQUEST_URI']; $req_uri_array = explode('?', $req_uri); $req_uri = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $req_uri_array;
But I still have the same problem, so I didn't put the fix at the good place. I've made a search and the REQUEST_URI variable is used in 33 files. So if the parse_request is not the route parser...
... how can we make WordPress (MU) support parent Url Rewriting ?