httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct DOCUMENT_ROOT, also causes issues with mod_rewrite
Date Fri, 21 Nov 2008 23:45:03 GMT

--- Comment #6 from Bob Ionescu <>  2008-11-21 15:45:02 PST
(In reply to comment #5)
> and if that can't be done, mod_rewrite should be looking in the userdir before
> it looks in the DOCUMENT_ROOT.

I disagree that the Document_root should be set dynamically, since this is not
the document_root of that domain, but more or less an alias.

Where did you place the RewriteRule? Under which path (either .htaccess or
<directory...> section?

I assume a per-directory configuration under  /home/user/public_html/

Since your substitution index.php is a local filepath, i.e. it does not start
with a leading slash, mod_rewrite will add the directory prefix
/home/user/public_html/ which results in /home/user/public_html/index.php.
There are now two possible ways, while the 1st one will take precedence.

- mod_rewrite tries to replace the directory-prefix with RewriteBase, the
URL-path of /home/user/public_html/ is /~user/, so we need 'RewriteBase
/~user/'. Mod_rewrite replaces /home/user/public_html/ with /~user/ and goes
with /~user/index.php into the internal redirect

- mod_rewrite tries to substitute the document_root from the directory-prefix.
If your URL-path is not related to the filesystem path, this reduction feature
will fail.

As the documentation states "If your webserver's URLs are not directly related
to physical file paths [that is the case if you're using mod_userdir or
mod_alias], you will need to use RewriteBase in every .htaccess file where you
want to use RewriteRule directives."

What do you mean by "It will be looking in:"? The self reduction process to an
URL-path will fail, so your "URL-path" is now /home/user/public_html/index.php
- the same, if you typed into your browser's location bar And such a request will be
mapped to /var/www/home/user/public_html/index.php.

Remember: At the end of th rewriting process, mod_rewrite needs an URL-path,
you can either define the path directly in the substitution:
  RewriteRule ^foo /~user/index.php [L]
or use the features provided by mod_rewrite to built the URL-path, but one
won't work in all cases (as documented).

Therefore I cannot see a bug, that's exactly the case why the directive
RewriteBase was developed.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message