How do I redirect subdomains that do not exist?
snippet in htaccess

How do I redirect subdomains that do not exist?

user7950

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.domain\.com
RewriteRule ^(.*)$ http://domain.com/$1 [R=301]

RewriteCond %{HTTP_HOST} ^ks\.domain\.com
RewriteRule ^(.*)$ http://kansas.domain.com/$1 [R=301]

RewriteCond %{HTTP_HOST} ^ia\.domain\.com
RewriteRule ^(.*)$ http://iowa.domain.com/$1 [R=301]

RewriteCond %{HTTP_HOST} ^domain\.com
RewriteCond %{REQUEST_URI} ^/sites/?$
RewriteRule ^(.*) / [R=301]

RewriteCond %{HTTP_HOST} ^domain\.com
RewriteCond %{REQUEST_URI} ^/sites/iowa/?$
RewriteRule ^(.*) http://iowa.domain.com/ [R=301]

RewriteCond %{HTTP_HOST} ([a-z0-9-]+)\.domain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) http://domain.com/ [R=302]

RewriteCond %{HTTP_HOST} ^domain\.com
RewriteCond %{REQUEST_URI} ^/sites/([a-z0-9-_]+)/?
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*) http://domain.com/ [R=302]