Hello List,
i dont know if im right here, or that i should file a bugreport, but i will
post my problem here first.
I have an easy rewrite Rule, which rewrites everything to /index.php, when the
filename or directory doesnt exist.
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Sometimes and really random i become an bad request error 400 back.
After debugging a litte bit i found, that there were changes made with the
"context docroot"
Here are the rewrite logs from an failed and from an working request:
FAILED:
rewrite '2014/tree/' -> '/index.php'
trying to replace prefix
/www/471639_96450/gn2-hosting.de/host260161/host260155/danielbaer.eu/ with /
trying to replace context docroot with context prefix
internal redirect with index.php [INTERNAL REDIRECT]
WORKING:
rewrite '2014/tree/' -> '/index.php'
trying to replace prefix
/www/471639_96450/gn2-hosting.de/host260161/host260155/danielbaer.eu/ with /
trying to replace context docroot \xa0/\xde\v\xd8/\xde\v\x901\xde\v with
context prefix
internal redirect with /index.php [INTERNAL REDIRECT]
It doesnt work, when when ap_context_document_root(r) is empty, but not NULL.
Sometimes it gives me strange docroot folders back like
\xa0/\xde\v\xd8/\xde\v\x901\xde\v
In 2.4.19 ( i think ) a new option in mod_rewrite was added and i think there
could be an error there:
/* No base URL, or r->filename wasn't still under dconf->directory
* or, r->filename wasn't still under the document root.
* If there's a context document root AND a context prefix, and
* the context document root is a prefix of r->filename, replace.
* This allows a relative substitution on a path found by
mod_userdir
* or mod_alias without baking in a RewriteBase.
*/
if (tmpfilename == r->filename &&
!(dconf->options & OPTION_IGNORE_CONTEXT_INFO)) {
if ((ccp = ap_context_document_root(r)) != NULL) {
const char *prefix = ap_context_prefix(r);
if (prefix != NULL) {
rewritelog((r, 2, dconf->directory, "trying to replace "
"context docroot %s with context prefix %s",
ccp, prefix));
r->filename = subst_prefix_path(r, r->filename,
ccp, prefix);
}
}
}
After adding "RewriteOptions IgnoreContextInfo" the random errors are gone.
So then. The question is: Bug or Feature and should i file this bug somewhere ?
Greetings,
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]