Wildcard subdomain redirections


#1

I want a wildcard subdomain subdomain.example.com/login will be redirected to www.example.com/login how can i achieve this using htaccess? And can you please give an example on how to do this, because i’m not familiar with htaccess thank you.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.+).example.com\login [NC]
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/login/$1 [L,NC,QSA]