• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subdomains, rewriting

#1
[eluser]La Loutre[/eluser]
Hi all,

I started a Code Igniter app which needs a "logical subdomain" management. Each subdomain is a "space", which indicates some data.

For instance, here two URLs :
Code:
http://space1.mysite.com/tools
Code:
http://space2.mysite.com/tools

They both lead to the "Tools" controller, but the first one for the space "space1", and the second one "space2".

The controller need to know in which space he's called. So my idea was to use Apache url_rewriting to change URLs this way :
Code:
http://space1.mysite.com/tools
become
Code:
http://www.mysite.com/sub/index/space1/tools
and to create a technical controller called "Sub", with an "index" method which has to :
- save the current space (space1)
- call the right controller (tools in this case).

Of course, this should work with more complex URLs, like :
Code:
http://space1.mysite.com/tool/see/12
become
Code:
http://www.mysite.com/sub/index/space1/tool/see/12 (controller "tool", method "see").

I managed to write the url_rewriting part, but I can't find a way to solve the CI "technical controller" part : how to nicely call a controller with the new URL from a controller ?

(I tried some basic routing rules, with the routes.php config file, but it crash my url_rewriting rules...)

Thanks a lot for any clue.

Philippe

#2
[eluser]La Loutre[/eluser]
Nobody has an idea about this problem ?
Sorry for the bump, bit I can't find a good solution...

#3
[eluser]Mareshal[/eluser]
why don't you create subdomains from cpanel? or you're working on localhost?

a subdomain on internet is another folder folder in root.

#4
[eluser]La Loutre[/eluser]
In fact, "spaces" are logical subdomains. They refer to the same controllers, and users will be able to create them anytime.
For the record, yes, I'm working on localhost, but I configured my hosts file to simulate those subdomains calls.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.