httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <>
Subject Re: [users@httpd] mod_rewrite confusion
Date Thu, 08 Mar 2012 22:42:07 GMT
On Thu, Mar 8, 2012 at 5:21 PM,  <> wrote:
> newb question.
> I need to redirect everything from and
> to Because several boxes share the
> same configuration and some of them will serve, I
> can't use a plain redirect.
> This rule to do the redirect, and every variation I've tried, doesn't
> ever match:
> RewriteCond %{HTTP_HOST}     !^admin\.mysite\.com$ [NC]
> RewriteRule  ^/admin         [R=301,L]
> What am I missing? Any help is greatly appreciated.

If you're in <Directory> or htaccess context, the part of the URL that
lead you to that context, including a trailing slash, is stripped from
the string you're comparing to.

So if this is in the docroot, RewriteRule compares against "admin" not
"/admin" since / is stripped out.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message