Wildcard subdomain returns 404

I’m trying to make a wildcard subdomain work.
Any subdomain of the website should point to the website itself, like
test.website.com should poiint to → website.com.

Right now, the website itself works fine, but for any subdomains I’m getting a 404.

In vhost conf Ive used:
docRoot $VH_ROOT/public_html
vhDomain $VH_NAME
vhAliases *.$VH_NAME
adminEmails email@gmail.com
enableGzip 1
enableIpGeo 1

rewrite {
enable 1
autoLoadHtaccess 1
logLevel 9

accessControl {
allow ALL

and its not working at all.

I also have a .htaccess containing:

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.)
RewriteRule .
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.website\.com$
RewriteRule ^ https://%1.website.com%{REQUEST_URI} [NE,L,R]

Header set Access-Control-Allow-Origin “*”