I have this code below which is supposed to redirect a subdomain to a directory in .htaccess. What I am trying to do is make it so that every user on my site has their profile located at username.mysite.com. I already changed the DNS records for a wild card and the code that I have previously worked, but for some reason it isn't anymore. Can anyone help, thanks.
RewriteBase /
RewriteCond s%{HTTPS} ^((s)on|s.*)$ [NC]
RewriteRule ^/*(.+/)?([^.]*[^/])$ http%2://%{HTTP_HOST}/$1$2/ [L,R=301]
RewriteCond %{HTTP_HOST} ^website\.?com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.website\.?com [NC]
RewriteCond %{REQUEST_URI} !/
RewriteRule ^(.*)$ $1 [L]
RewriteBase /
RewriteCond s%{HTTPS} ^((s)on|s.*)$ [NC]
RewriteRule ^/*(.+/)?([^.]*[^/])$ http%2://%{HTTP_HOST}/$1$2/ [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.website\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.website\.com$ [NC]
RewriteCond %{REQUEST_URI} !userdir/
RewriteRule ^(.*)$ userdir/$1 [L]