Welcome Guest, Not a member yet? Register   Sign In
How to accomplish this > www.mysite.com/username/controller/function/id
#16

[eluser]jadebot[/eluser]
Hey guys, I am going to hijack my own thread here (kinda). I have been using my hack here to move production along when it finally hit me:

I can use virtual subdomains rather than "mysite.com/user". So ideally it will be user.mysite.com/controller/method. Yes I'm an idiot!

So now after an hour of trying to learn regex I'll appeal to those better than me.
The plan is to use mod rewrite to simply point any subdomain to the main site.
Example:
Code:
user1.mysite.com/blah -> mysite.com/blah
user2.mysite.com/blah -> mysite.com/blah

I can then extract the subdomain from fetching the URL (since the url will still be user1.mysite.com/blah )
and load the user session that way.

If anyone can help me I would greatly appreciate it. I can drop someone $15(us) via paypal or tipjoy as a tip.

So here is a conceptual approach to the rewrite rules:
Code:
IF URL contains subdomain
   remove it, so that it rewrites to mysite.com/....
   also needs to work with the rewrite in CI that removes the index.php
   what I am using is below...
       RewriteCond $1 !^(index\.php|images|robots\.txt|system|js|data)
    RewriteRule ^(.*)$ /index.php/$1 [L]
ELSE
   just rewrite for index.php (I'll load my main site there)

Any help is appreciated. Regex is way over my head!


Messages In This Thread
How to accomplish this > www.mysite.com/username/controller/function/id - by El Forum - 12-08-2008, 04:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB