> Is it possible to write a .htaccess file that works 
> *no matter* where it is located

I don't believe so.

If the .htaccess file lives in a directory inside of the Apache root directory, then you _don't_ need to specify a RewriteBase.  It's really only necessary when .htacess lives in a virtual directory outside of the Apache root.


David Walker
Library Web Services Manager
California State University
From: Code for Libraries [[log in to unmask]] On Behalf Of Godmar Back [[log in to unmask]]
Sent: Wednesday, July 01, 2009 6:20 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] tricky mod_rewrite

On Wed, Jul 1, 2009 at 9:13 AM, Peter Kiraly <[log in to unmask]> wrote:

> From: "Godmar Back" <[log in to unmask]>
>> is it possible to write this without hardwiring the RewriteBase in it?  So
>> that it can be used, for instance, in an .htaccess file from within any
>> /path?
> Yes, you can put it into a .htaccess file, and the URL rewrite will
> apply on that directory only.

You misunderstood the question; let me rephrase it:

Can I write a .htaccess file without specifying the path where the script
will be located in RewriteBase?
For instance, consider
Here, anybody who wishes to use this code has to adapt the .htaccess file to
their path and change the "RewriteBase" entry.

Is it possible to write a .htaccess file that works *no matter* where it is
located, entirely based on where it is located relative to the Apache root
or an Apache directory?

 - Godmar