On Thu, Mar 8, 2012 at 5:21 PM, <maillists0@xxxxxxxxx> 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@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx