Print

Print


You probably could if you get real tricky with the regex code - but I would
say probably not.  rewrite takes the entire url into consideration - so you
need to denote where to start with the rewrite base.

I use this for vufind:
RewriteRule ^([^/]+)/(.+)$ index.php?module=$1&action=$2 [L,QSA]

Which allows you to map:
vufind.library.edu/Search/Results
to:
vufind.library.edu/index.php?module=Search&action=Results

So with that - you could capture all of the "directories" in the URL and
just remove anything that doesn't look familiar.  But that is very hackish
since it could easily break and make it very difficult for someone to debug.

Andrew

On Wed, Jul 1, 2009 at 9:20 AM, Godmar Back <[log in to unmask]> wrote:

> 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
>
> http://code.google.com/p/tictoclookup/source/browse/trunk/standalone/.htaccess
> 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
>