[wp-trac] [WordPress Trac] #23073: Wrong RewriteRule in a local Multisite installation
WordPress Trac
noreply at wordpress.org
Thu Jan 3 14:54:57 UTC 2013
#23073: Wrong RewriteRule in a local Multisite installation
--------------------------------------------+--------------------
Reporter: Guy_fr | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.5.1
Component: Multisite | Version: 3.5
Severity: normal | Resolution:
Keywords: dev-feedback reporter-feedback |
--------------------------------------------+--------------------
Comment (by guy_fr):
Replying to [comment:9 evansolomon]:
> Replying to [comment:7 SergeyBiryukov]:
> > Related: #23104
>
> This seems like a likely culprit. Does stuff like
`$_SERVER['DOCUMENT_ROOT']` use unix-style paths even on windows? If so,
that would be an obvious reason it would break, and the patch from #23104
looks like it would fix it.
First, Happy new year :)
Actual configuration is:
{{{
$_SERVER["DOCUMENT_ROOT"]: C:/wamp/www
realpath($_SERVER["DOCUMENT_ROOT"]): C:\wamp\www
ABSPATH: C:\wamp\www\multitest/
slashed_home: http://localhost/multitest/
$base: /multitest/
}}}
with the #23104 patch, local variables in the network_step2 function will
become:
{{{
$wp_dir_from_root: \multitest/
$wp_siteurl_subdir: /\multitest/
$rewrite_base: \multitest/
}}}
Which is not correct as the suggest lines in the .htacces will be:
{{{
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)
\multitest/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ \multitest/$2 [L]
}}}
One fix could be to replace \ by / in the call to the global ABSPATH
variable when building the $wp_dir_from_root:
{{{
$wp_dir_from_root = preg_replace( '#^' . preg_quote(
$_SERVER['DOCUMENT_ROOT'], '#' ) . '#', '', preg_replace('/\\\\/', '/',
ABSPATH));
}}}
with that fix, local variables in the fucntion will be:
{{{
$wp_dir_from_root: /multitest/
$wp_siteurl_subdir: /
$rewrite_base:
}}}
and in the suggest for .htaccess file, you will find:
{{{
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
}}}
which is not breaking acces to secondary site when installing on a windows
local machine.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23073#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list