# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# custom rules for subdomain matching
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteRule . https://example.com/%1 [R=301,L]
# default WordPress rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Replace example.com with your domain name. You will need to add this in your htaccess file on root. You don’t need to create a sub domain as well. for more details see this
https://wordpress.stackexchange.com/questions/258006/how-to-add-a-custom-redirect-rule-for-sub domains