I use WordPress and would like to redirect all non-existing subdomains (or all subdomains) to the main domain.
Examples of urls to be redirected:
subdomains.example.com
subdomains.example.com/xxx
subdomains.example.com/xxx.html
subdomains.example.com/t/xxx.php
TO
www.example.com
This is my default WordPress .htaccces
of the main domain (I am editing this). Any folders or files for non-existing subdomains do not exist.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
not
operator!
likeRewriteCond %{HTTP_HOST} !^example\.com$
, it'll take care of all the subdomains. Anyways, I would answer your question to the point, but this question is off topic here.*.example.com
to point to your main domain from your DNS setting.