Dynadot — .com Registration $8.99

Mod_rewrite, something.site.com

Spaceship Spaceship
Watch

squid

Account Closed
Impact
19
Hey
You know how sites like Newgrounds work, with http://USERNAME.newgrounds.com or http://VARIABLE.site.com and then it takes that word, how's it done?

Presumably it's done with $_GET['variable']; but how would i tell the script that the GET is that string?

Is it with mod_rewrite? A link would be helpful, or even a code snippet explaining, ty. :)

User goes to http://LOLHI.website.com then page then echo's "LOLHI", because LOLHI is the $variable.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
1. you'll need wildcard dns setup, unless you plan on setting up each sub domain yourself.

2. to get the domain name, you'll need $_SERVER['SERVER_NAME']

3. to get the first part of the domain, you can convert it to an array:

PHP:
$domainparts = explode('.',$_SERVER['SERVER_NAME']);
echo $domainparts[0];
 
0
•••
Sounds like your doing a free subdomain hosting kind of thing. I made several of these scripts, e107deluxe.com is one of my creations....its fairly easy to do:

Open your httpd.conf file and where you have the record for your domain all the way down the bottom of the file, find thid:

ServerAlias yourdomain.com
and change it to this:
ServerAlias *.yourdomain.com

Save and exit, then restart apache.

Now use the code posted by -NC- to finish it off!
 
0
•••
Yeah, i should have posted saying i managed it, but I managed it just after NC posted, using his post + some google knowledge :)

It was for http://somebody.lovescitricsquid.info and a few other similar sites i want to make ^__^

Thanks anyway <3
 
0
•••
RickM said:
Sounds like your doing a free subdomain hosting kind of thing. I made several of these scripts, e107deluxe.com is one of my creations....its fairly easy to do:

Open your httpd.conf file and where you have the record for your domain all the way down the bottom of the file, find thid:

ServerAlias yourdomain.com
and change it to this:
ServerAlias *.yourdomain.com

Save and exit, then restart apache.

Now use the code posted by -NC- to finish it off!

Very good post Rick, it helped me a lot too.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back