2

I am planning to build a website that which have a domain and automatically generated sub-domains.

Ex : a user registering on http://www.domain.com so after registration he will get a sub-domain ie : user.mydomain.com ,this page is users page.

i am planning to do this with the following architecture:

domain.com/index.php/profile/user/username

where profile is the controller ,user is the function and username is the parameter ,so when a user entered username.domain.com ,i don’t want to redirect the page ,but i want show contents from “domain.com/index.php/profile/user/username” on username.domain.com. is there anyway to do this ? i have full access to hosting provider,so what method is useful & ease for me ? something like .htaccess ?? or any other ? actually i want to follow the blogger.com style on my website,one more think that i want to give option to users to allow custom domains instead of sub-domains.

i am little bit newbie here,expecting detailed reply.

Thank you . Note : i already posted this on codeigniter forum too , but Stackoverflow is so fast & expert on this.

1 Answer 1

2

You are looking at DNS wildcard hosting: take a look at http://sebastiano.ezion.cc/2008/03/08/wildcard-dns-and-php/ for an example, but you'll need to fetch the $_SERVER["HTTP_HOST"] value, then extract the first part of the domain to get the username. You can then show the proper content.

How you do the actual DNS wildcard depends on your hosting provider.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for replying ,But getting the username is not a hard part ,actually i am talking about Url rewriting ,Mod rewriting ,Htaccess etc..i dont have any other files on subdomain ,its virtual.
Could you pleas help me how can i solve this with term codeigniter ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.