Welcome Guest, Not a member yet? Register   Sign In
Advanced Controller Routing (based on domain)
#5

[eluser]stealthify[/eluser]
Wow, this is genius! I hadn't even considered this approach, and it appears to be working well. I took your advice, and added HMVC to my application, and then reworked the file structure. As it stands now, this is what I'm working with:

-------------------------------------
frameworks/
-- codeigniter/
---- core/
---- database/
---- .. etc


public_html/
-- .htaccess
-- index.php
-- application/
---- cache/
---- config/
---- core/
---- ...etc
---- modules/
------ domain1/
-------- controllers/
---------- home.php
---------- about.php
-------- views/
---------- home.php
---------- about.php
------ domain2/
-------- controllers/
---------- home.php
---------- about.php
-------- views/
---------- home.php
---------- about.php

-------------------------------------

With the above, I have successfully gotten the following to work, each with their unique controllers and views:

http://localhost/public_html/domain1/
http://localhost/public_html/domain1/about

http://localhost/public_html/domain2/
http://localhost/public_html/domain2/about

Looks great!

Now that the game has changed, a new question has come up. In my current .htaccess (in the public_html) folder, I have the following rewrite condition:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt|user_guide)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

I have been struggling throughout the night to figure out the best way to capture the domain that is requesting the public_html directory, and then disguising what they see so that all they see is the following:

http://www.domain1.com/
http://www.domain1.com/about

and

http://www.domain2.com/
http://www.domain2.com/about

I suspect this will have something to do with %{HTTP_HOST} and %{REQUEST_URI}, but I can't find a combination that works, especially with the current condition for the index.php/$1 rule.

Willing to help me determine what my final htaccess should look like?

Thanks again for the help so far.


Messages In This Thread
Advanced Controller Routing (based on domain) - by El Forum - 07-05-2011, 08:18 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-05-2011, 08:19 PM
Advanced Controller Routing (based on domain) - by El Forum - 07-05-2011, 10:39 PM
Advanced Controller Routing (based on domain) - by El Forum - 07-05-2011, 11:02 PM
Advanced Controller Routing (based on domain) - by El Forum - 07-07-2011, 08:58 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-07-2011, 09:23 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-07-2011, 09:35 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-07-2011, 09:41 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-08-2011, 12:42 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-08-2011, 06:07 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-08-2011, 06:18 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-08-2011, 06:43 AM
Advanced Controller Routing (based on domain) - by El Forum - 07-08-2011, 07:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB