views:

27

answers:

1

I'll like to update the following rewrite condition to only allow one particular subdomain.

RewriteCond %{HTTP_HOST} !^domain.com$ [NC]

At the moment, it matches all subdomains, but I'd like to allow just one - admin.domain.com. How would I do this?

Thanks for any help in advance.

+1  A: 

It should work:

RewriteCond %{HTTP_HOST} admin.domain.com [NC]
RewriteRule //whatever

Am I wrong?

Enrico Carlesso
It could, but then I'd lose the redirect from www to non-www. I settled on this: RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]I'll check you as the answer since technically yours should work to fix the admin redirect problem.
Steve