Hello
I have the following records in the DNS
domain.tld A xyz.xyz.xyz.xyz
www CNAME domain.tld
* CNAME domain.tld
The website is built on wordpress. The VirtualHost settings are:
<VirtualHost *:80>
ServerAdmin support@domain.tld
DocumentRoot /var/web/domain.tld
ServerName www.domain.tld
ServerAlias *.domain.tld domain.tld
CheckSpelling on
<Directory />
AllowOverride all
</Directory>
ErrorLog /var/log/apache2/domain.tld.error
CustomLog /var/log/apache2/domain.tld.access common env=!dontlog
</VirtualHost>
When I write domain.tld in the address bar I am redirected to www.domain.tld. But when i wtite test.domain.tld I am not being redirected and the url stays test.domain.tld . How can I achive to be redirected to www.domain.tld when typing any subdomain of domain.tld? Obviously the VirtualHost directive does not work (using apache2). How can I do it with modRewrite? Now the contents of htaccess are:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Please post some feedback, deeply appreciated.