httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
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,  <maillists0@gmail.com> wrote:
> newb question.
>
> I need to redirect everything from www.mysite.com/admin and
> mysite.com/admin to admin.mysite.com. Because several boxes share the
> same configuration and some of them will serve admin.mysite.com, 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                  https://admin.mysite.com [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: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message