How can i create subdomain

Reply

Join Date: May 2008
Posts: 15
Reputation: phpuser is an unknown quantity at this point 
Solved Threads: 1
phpuser phpuser is offline Offline
Newbie Poster

How can i create subdomain

 
0
  #1
Jun 30th, 2008
I made one php project in which we provide facility to create his/her own web site.
Now I wants to add new feature giving different subdomains to the
members' web pages.

Because the number of members is about 120,000, manual configuring is
not the solution.

Let me give you an example.
1) We have domain name such as 'osteopathicwebsites.com'.
2) Someone joined osteopathicwebsites.com with account 'mxi'.
3) He get his own direcory in our Web server such as /mxi/.
(It's url become 'http://www.osteopathicwebsites.com/mxi/' for redirecting his own page.)

4) And I required he should get the subdomain 'mxi.osteopathicwebsites.com' (How can we
implement this???)

If anyone have any any idea then please suggest me.I also try myself by google.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,073
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: How can i create subdomain

 
0
  #2
Jul 1st, 2008
Originally Posted by phpuser View Post
I made one php project in which we provide facility to create his/her own web site.
Now I wants to add new feature giving different subdomains to the
members' web pages.

Because the number of members is about 120,000, manual configuring is
not the solution.

Let me give you an example.
1) We have domain name such as 'osteopathicwebsites.com'.
2) Someone joined osteopathicwebsites.com with account 'mxi'.
3) He get his own direcory in our Web server such as /mxi/.
(It's url become 'http://www.osteopathicwebsites.com/mxi/' for redirecting his own page.)

4) And I required he should get the subdomain 'mxi.osteopathicwebsites.com' (How can we
implement this???)

If anyone have any any idea then please suggest me.I also try myself by google.
Here is one way to do it:

You need to be able to edit your dns records. Add a wildcard entry for your domain.

Then configure your webserver to serve for each subdomain as well. This depends on the webserver. With apache it would involve creating a virtual host (edit http.conf) and have it serve for your subdomains.

eg:

  1. <VirtualHost *.osteopathicwebsites.com>
  2. ServerAdmin webmaster@osteopathicwebsites.com
  3. DocumentRoot /path/to/osteopathicwebsites.com/root/
  4. ErrorDocument 404 /404.html
  5. ErrorLog /etc/log/osteopathicwebsites.com/error.log
  6. TransferLog /etc/log/osteopathicwebsites.com/access.log
  7. </VirtualHost>

It would actually just mimic what osteopathicwebsites.com has configured, and point to the same document root. So that osteopathicwebsites.com serves all documents for any subdomain.

Then in your php, check for the subdomain, I believe it should be $_SERVER['SERVER_NAME']. Then display the users page based on that...
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 67
Reputation: casper_wang is an unknown quantity at this point 
Solved Threads: 6
casper_wang's Avatar
casper_wang casper_wang is offline Offline
Junior Poster in Training

Re: How can i create subdomain

 
0
  #3
Jul 1st, 2008
as far as I know, a sub domain " sub_domain.domain.com " can't be created by a PHP script or any other script at that.
It's a question of a server configuration.
If you have access to your host server admin area (Like PLESK) you might have the option to create them yourself. If not you will probably have to contact your host company and ask them to create one for you.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 67
Reputation: casper_wang is an unknown quantity at this point 
Solved Threads: 6
casper_wang's Avatar
casper_wang casper_wang is offline Offline
Junior Poster in Training

Re: How can i create subdomain

 
0
  #4
Jul 1st, 2008
Originally Posted by phpuser View Post
3) He get his own direcory in our Web server such as /mxi/.
(It's url become 'http://www.osteopathicwebsites.com/mxi/' for redirecting his own page.)
I oppologize I mis-read your situation.
This IS possible.
use a simple redirect to redirect them, have the php create a file on your server, with read and write access granted to that user (this will require the edit of your .htaccess file.
when they log in on your main site their user name (from your database) will redirect them to their home page. in order for them to upload their files is another issue as you dont want them to have full access to your ftp nor your databse. so you will need to set up a control panel for each new site with permisions being restricted to that person for uploads and edits of their own files, etc etc.

Its not all that difficult but it is time consuming. this such a thing could take as many as 10 php scripts all running together and security should be your biggest concern for offering free web hosting.
Also you may find yourself inside legal ramifications if the host who is hosting your site finds that you are using their service to host other sites without their consent.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC