[Gllug] Mixing mod_rewrite and mod_alias
Robert McKay
robert at mckay.com
Mon Jul 15 08:40:38 UTC 2002
On Mon, 15 Jul 2002 tet at accucard.com wrote:
> Like the subject says, is it possible? I currently use mod_alias to
> remap certain URLs to an alternative DocumentRoot:
> Alias /marketing /new/document/root
> However, we now have a need to redirect URLs in that directory elsewhere,
> but only if the referrer is google (don't ask). So I've been trying to
> use mod_rewrite:
> RewriteEngine On
> RewriteCond %{HTTP_REFERER} google.com
> RewriteRule /marketing/oldurl.html /marketing/newurl/
> However, what I'm getting is:
>
> (2) init rewrite engine with requested uri /marketing/oldurl.html
> (2) rewrite /marketing/oldurl.html -> /marketing/newurl/
> (2) local path result: /marketing/newurl/
> (2) prefixed with document_root to /old/document/root/marketing/newurl/
> (1) go-ahead with /old/document/root/marketing/splashpage_0009/ [OK]
You can specify the new base with the:
ReWriteBase /new/document/root
directive right before your ReWriteRule, that way when it gets re-written
the new document root base will be prepended and the resulting url will be
what you want ie:
/new/document/root/marketing/newurl
Regards,
Robert.
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list