Problem with .htaccess - Subdomain |
[eluser]ci_fan[/eluser]
Hi guru. I face a problem like this: My site is a education site www.domain.com, allow my client creates account that they can post their own content <--- after create account a unique username of them will be generated and it will used as a subdomain. example: username abc ---> user can visit their site as abc.domain.com All will be dynamic, I try it with htaccess but it doesn't works What I want is when user visit abc.domain.com --> it will understand that domain.com/client/index/abc ( controller: client, function: index, param: abc) Hope someone can help me Sorry for my bad English Thanks
[eluser]ci_fan[/eluser]
Another things: if I has many controllers, do I need to make it all in htaccess? Example: If user visit: abc.domain.com/register --> the hidden running is domain.com/register/index/abc abc.domain.com/aboutus --> the hidden running is domain.com/page/index/abc/aboutus Thanks
[eluser]weboap[/eluser]
when you talk about abc.domain.com you are talking about adding a virtual host to httpd.conf the apache conf file every time you add a subdomain... all i can say at the moment is you can use the wild card *.domain.com then add the redirect to your .htaccess to take the user to domain.com/abc but you will have a twist there where your base_url() will be what you fix it to http://domain.com , you can workaround that to make it relative to what url is typed in the browser to rich your site but how will that affect your app as the base_url will be abc.domain.com for user 1 and xyz.domain.com for user 2. it will be interesting to see if somebody have a solution to this one. good luck.
[eluser]ci_fan[/eluser]
Thanks weboap for reply All I want is htaccess and code ( maybe config, route ..) but NOT in httpd.conf Yes you are right "abc.domain.com for user 1 and xyz.domain.com for user 2" --> I mean, how to know which content belong to which user ( when access controller I must know this param to get the correct content) Any new suggestion? I have read this http://ellislab.com/forums/viewthread/100368/#508141 but I still can't do
[eluser]weboap[/eluser]
the post in question talk about 1 specific subdomain Code: So point your new subdomain to the folder that ci is in…ask your webhost how.... // the httpd.conf part i talked about Code: RewriteCond %{HTTP_HOST} ^categories.site.com the same steps i talked about above!
[eluser]ci_fan[/eluser]
All is dynamic, when client register with username ---> then they can visits the abc.domain.com ( they can;t wait until I ask webhost to add a subdomain and config htacces code ...) abc.domain.com xyz.domain.com .... thay just have the same FUNCTION, only different on content ---> so the controller user the same : register, page, contact .... Thanks
[eluser]gRoberts[/eluser]
I was going to set this up on my domain but it seems my host, because I don't host my DNS with them, refuses to allow it to work... Fun eh. From what I understand, it may take some "work" but you shouldn't need to change anything regarding the .htaccess or routes. Simply put, if you go to www.domain.com, your controller/action will get the base_url() and determine the subdomain from that. From there, you can load subdomain specific content.
[eluser]gRoberts[/eluser]
Blah, I've taken the leap. I've moved my domain over to my hosts nameservers. It is showing the correct name servers in the whois, however it's not working at the moment. Once 24 hours is up, I'll double check and create some sample code.
[eluser]ci_fan[/eluser]
thanks for your reply gRoberts can you tell me quick code about "if you go to www.domain.com, your controller/action will get the base_url() and determine the subdomain from that. From there, you can load subdomain specific content." ? Thanks |
Welcome Guest, Not a member yet? Register Sign In |