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?
You can set the
ServerAliasdirective in your VirtualHost configuration to*.mysite.com. You can then usemod_rewritein the.htaccessto append the username to the URL, or use PHP to pull the subdomain off the requested URL, and do whatever you want with it.