| | |
How can i create subdomain
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 15
Reputation:
Solved Threads: 1
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.
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.
•
•
•
•
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.
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:
PHP Syntax (Toggle Plain Text)
<VirtualHost *.osteopathicwebsites.com> ServerAdmin webmaster@osteopathicwebsites.com DocumentRoot /path/to/osteopathicwebsites.com/root/ ErrorDocument 404 /404.html ErrorLog /etc/log/osteopathicwebsites.com/error.log TransferLog /etc/log/osteopathicwebsites.com/access.log </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!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
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.
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.
•
•
•
•
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.)
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.
![]() |
Similar Threads
- create subdomain in server dynamically using php (PHP)
- how to create subdomain ? (VB.NET)
- ASP - How to create Subdomain (ASP)
Other Threads in the PHP Forum
- Previous Thread: how to use aspell in php
- Next Thread: include function in php
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code codingproblem cron curl customizableitems database date display dynamic echo email error errorlog file files filter folder form format forms forum function functions gc_maxlifetime global google headmethod host href htaccess html image include insert ip javascript joomla limit link login mail malfunctioning memmory memory menu mlm multiple mysql nodes oop parameter parsing paypal pdf php phpmysql problem query radio random recursion recursiveloop remote script search select server sessions sms snippet source space sql static survey syntax system table trouble tutorial up-to-date update upload url validator variable video web youtube






