Apache Reference: mod_rewrite, RewriteBase

RewriteBase

Rewrite URL Base
Syntax: RewriteBase A
Example: RewriteBase /~foo/bar/
Since: Apache 1.2

This directive explicitly sets the base URL for per-directory rewriting. It is useful because RewriteRule can be used in per-directory configuration files where it will act locally. That is, the local directory prefix is stripped at this stage of processing and your rewriting rules act only on the remainder. The URL is added automatically at the end. Thus, when a substitution occurs for a new URL, mod_rewrite reinjects the URL into the server processing. To carry out this task, it needs to know the corresponding URL prefix or URL base. By default, the URL prefix is the corresponding file path itself. At most web sites, however, URLs are not directly related to physical file name paths, so this assumption will be usually be wrong! In such a case, you must use the RewriteBase directive to specify the correct URL prefix.