[Gllug] Mixing mod_rewrite and mod_alias

tet at accucard.com tet at accucard.com
Mon Jul 15 08:24:04 UTC 2002

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]

I.e., the Alias line isn't taking effect for rules rewritten with
mod_rewrite, and it's using the old document root, not the new one.

Any ideas?


PS. Yes, I know I can solve this using symlinks instead of mod_alias, and
    I may well resort to that. However, I'd like to know why this doesn't
    work anyway...

Gllug mailing list  -  Gllug at linux.co.uk

More information about the GLLUG mailing list