Wildcard subdomain redirections

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]

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.