vForums Support > Programming & Coding :: Programming Discussion :: > wildcard subdomain htaccess

wildcard subdomain htaccess - Posted By ashkir (ashkir) on 24th Nov 10 at 2:05am
I have various files for friends on my site that are listed under folders like mydomain.com/user/NAME I can make a wildcard subdomain so all subdomains will be the exact same as mydomain.com ; but how can I get the htaccess to react that way?

Basically I want NAME.mydomain.com to an alternative to mydomain.com/user/NAME

Re: wildcard subdomain htaccess - Posted By Marc (cr0w) on 24th Nov 10 at 2:38am
http://www.easymodrewrite.com/example-subdomains

Merry Christmas. {Smile}

Re: wildcard subdomain htaccess - Posted By ashkir (ashkir) on 24th Nov 10 at 2:42am
 
Thanks! BWF told me they'd set up wildcard, if I set up the htaccess.

Now to figure out how to make subdomain.mydomain.com match up with mydomain.com/user/subdomain


Re: wildcard subdomain htaccess - Posted By ashkir (ashkir) on 24th Nov 10 at 3:18am
Would something like this work?:

Code:
 
  1. Options -Multiviews
  2.  
  3. RewriteEngine On
  4. RewriteBase /
  5.  
  6. # Force search engines to use mydomain.com
  7. RewriteCond %{HTTP_HOST} !^mydomain\.com$
  8. RewriteRule ^(.*) http://mydomain.com/$1 [R=301,L]
  9.  
  10. # Specify search friendly URLs
  11. RewriteRule ^([a-z]+)\.mydomain\.com$ /users/$1 [L]
 




Edit: nevermind. No idea how the hell to use wildcards.

Re: wildcard subdomain htaccess - Posted By Michael (wrighty) on 29th Nov 10 at 1:26pm
Did that code work? It should do - I remember setting this up for someone not long ago... Have you got this fixed? {Smile}