Reputation: 8366
I am trying to exclude the halcyondaysws subdomain from all my 301 redirects but can't manage it. I tried it like this:
RewriteCond %{HTTP_HOST} ^halcyondaysws\.maindomain\.net
RewriteRule .* - [S=7]
Redirect 301 /enamels.html http://www.halcyondays.co.uk/enamels/christening-nursery.html
and this
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ [NC]
RewriteRule /enamels.html http://www.maindomain.co.uk/enamels/christening-nursery.html [L,R=301]
But it doesn't work. We are using only one .htaccess
file.
Upvotes: 1
Views: 826
Reputation: 784878
To exclude a particular domain use this negation based condition:
RewriteCond %{HTTP_HOST} !^halcyondaysws\.maindomain\.net$ [NC]
RewriteRule ^enamels\.html$ http://www.maindomain.co.uk/enamels/christening-nursery.html [L,R=301,NC]
And test this after clearing browser cache.
Please understand this is not really excluding a sub-directory. Since your rule is targeting /enamels.html
hence there is no need to exclude a sub-directory.
Upvotes: 2