Jump to content

How to make subdomain by php


hno

Recommended Posts

HI,

I want to make a web site that every one can sign up and after that they would have a subdomain of my site name just like web log system .You know blogfa bogging system and when every one makes a new account they have a subdomain of that site.

I want to make something like that ,and after every ones registered they would have a subdomain of my site with a script installed it it.

How can make something like that?

I apologize for my bad english.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/200252-how-to-make-subdomain-by-php/
Share on other sites

mod_rewrite doesn't work for creating sub domains, to my knowledge.  sub domains require A or CNAME records, or they don't work. 

He was almost right. You need a wildcard A record (*.yourdomain.com), then you need to add it to your vhost, then here's an example .htaccess file to get it done:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]+\.example\.com$
RewriteRule !^index\.php$ index.php [L]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.