2

Possible Duplicate:
Create Subdomains on the fly with .htaccess (PHP)

for one of my scripts, i want it so that each of my clients has their own subdomain

however, i want each subdomain to use the exact same script, and the exact same database

can this be accomplished with HTACCESS?

example: john.mysite.com would take them to my script, setting a username variable as john...so they can be identified in the database...

how can i do this?

Community
  • 1
  • 1
scarhand
  • 4,269
  • 23
  • 63
  • 92

1 Answers1

3

You can set the ServerAlias directive in your VirtualHost configuration to *.mysite.com. You can then use mod_rewrite in the .htaccess to append the username to the URL, or use PHP to pull the subdomain off the requested URL, and do whatever you want with it.

Jim Rubenstein
  • 6,836
  • 4
  • 36
  • 54