Rewritebase – Oracle B12255-01 User Manual

Page 126

Advertising
background image

mod_rewrite

7-56

Oracle HTTP Server Administrator’s Guide

RewriteBase

Explicitly sets the base URL for pre-directory rewrites. Rewrite rule can

be used in per-directory configuration (.htaccess) files. When a substitution
occurs for a new URL, the base URL should be added into the server processing. To
be able to do this, the module needs to know what the corresponding URL-prefix or
URL-base is. By default, this prefix is the corresponding file path itself. However, at
most Web sites, URLs are not directly related to physical filename paths. In such
cases, you have to use the RewriteBase directives to specify the correct
URL-prefix.

If the URLs of your Web server are not directly related to physical file paths, you
have to use RewriteBase in every .htaccess files where you want to use
RewriteRule

directives.

Example 7–6

RewriteBase Directive

Assume the following per-directory configuration file:

## /abc/def/.htaccess - - per-dir config file for directory /abc/def

# /abc/def is the physical path of /xyz,

RewriteEngine On

RewriteBase /xyz

RewriteRule ^oldstuff\.html$ newstuff.html

In

Example 7–6

, a request to /xyz/oldstuff.html gets correctly rewritten to the

physical file /abc/def/newstff.html.

Advertising