I have a script which allows my members to create a free website, like geocities. As it is now, they get the url www.mysite.com/user, and would like to know if it is possible to use the .htaccess file to direct to user.mysite.com, without actually having to create the subdomain. Hope this makes sense.
RewriteEngine On Options +FollowSymlinks RewriteBase / RewriteCond %{HTTP_HOST} sub.yoursite.com RewriteCond %{REQUEST_URI} !subfolder/ RewriteRule ^(.*)$ subfolder/$1 [L] set your sub and your subfolder. This should work.
I tried it, and it didn't work. Even if it did, that way I would have to manually add it with each new membership signup. I'm looking for a way that with each new signup, it would automatically work. Thanks for your help anyways.
Along with the folder that needs to be setup,sd you also need to setup wildcard dns; if it isn't already. The users zone file would look something like: * 14400 A 123.123.123.123 This is the htaccess I"ve always used: RewriteEngine On Options +FollowSymlinks RewriteBase / Rewrite Rule for jane.domainname.com RewriteCond %{HTTP_HOST} jane.domainname.com$ RewriteCond %{REQUEST_URI} !jane/ RewriteRule ^(.*)$ jane/$1 If you have control of the server; then you could write a script that does all three at signup.
One other thing you need to do is to set up your dns entries for the subdomain. Jane.domainname.com isn't going to work unless it resolves to an address. Once the DNS solution is in place the rewrite rules should work.
if changing the script is not a oroblem, try hotscripts, there are a couple scripts that help u do this. u would still need to do the one time wildcard dns entry explained above.
That was the problem, my server doesn't allow wildcards, whatever the hell that means LOL. Thanks anyways.
What a coincidence! Today i was working on this subject and just uploaded the script to my friend's server, "url2subdomain" ; http://www.gitme.net/php/