Opened 14 years ago
Closed 14 years ago
#15478 closed enhancement (wontfix)
Wordpress (MU) doesn't consider $_SERVER['REDIRECT_URL']
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.1 |
Component: | Multisite | Keywords: | close |
Focuses: | Cc: |
Description
Hi,
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
/bar/
/foo/
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[0];
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[0];
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 ?
Change History (3)
#2
@
14 years ago
I have to agree in this case with westi, Not every case is going to be caught and handled.
My suggestion would be to put code in your wp-config.php or similar MU-related file (sunrise.php?) which manipulates REQUEST_URI based on REDIRECT_URI, WordPress will then be oblivious to the fact of the modifications you've made. (note: WordPress does re-create the REQUEST_URI later to work around certain server-level bugs, so you may not be able to use wp-config.php in all environments)
This sounds like an edge case that it is unlikely we are going to support in core.