Would it be possible to set a 301 redirect for
sub.domain.com to redirect to domain.com/directory
even when the subdomain does not exist.
Would it be possible to set a 301 redirect for
sub.domain.com to redirect to domain.com/directory
even when the subdomain does not exist.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(sub1|sub2)\.domain\.com
RewriteRule ^.*$ http://www.domain.com/$1 [R=301,L]
</IfModule>
This will redirect sub1.domain.com to www.domain.com/sub1. Replace domain.com with your address, and enumerate the subdomains you want to redirect using | as separator