Multiple applications, one index.php |
[eluser]DarKDinDoN[/eluser]
Hello ! I'm dealing with the multiple apps and only one index.php ... Here is the server's root folder : Code: ./system/ and my .htaccess to avoid the index.php : Code: RewriteEngine On And in the index.php, I manage to load the right app folder depending on the first url segment : Code: $url= $_SERVER['REQUEST_URI'] ; So, if I run : Code: http://www.example.com/ ---> should load the default app The right apps are displayed, but for the foo and bar apps, I get a CI 404 error ... did I miss something ?
[eluser]John_Betong[/eluser]
To find your errors I would be tempted to include this script in your index.php file to see what is changing: Code: echo '<pre>'; Instead of using .htaccess file I use a separate PHP file to: 1. start the session with session_start() 2. reset $_SESSION[‘_MENU_’] 3. select a new $_SESSION[‘_MENU_’] 4. redirect to index.php 5. test for the $_SESSION[‘_MENU_’] and set index.php -> $application_path ./index.php file. $application_folder = isset($_SESSION['_MENU_']) ? $_SESSION['_MENU_'] : "ci_jokes"; The separate PHP file only requires calling once and from then until the session expires the _MENU_ application is used/
[eluser]DarKDinDoN[/eluser]
Thanks John_Betong, I tried to display the server vars but nothing wrong... CI logs indicate that everything is going right and that it loads the error route as it should do ... :grrr: Can you post an example of your index.php and php session file ?
[eluser]John_Betong[/eluser]
Here we go http://johns-jokes.com/this-is-a-test-to...-works.php Code: <?php /* http://johns-jokes.com/this-is-a-test-to-see-if-it-works.php /* You can also check my http://johns-jokes.com/_menu.php Unfortunately none of the menu links work due to a recent upgrade to CI_2_0-Reactor // just back from my local, hope this works
[eluser]Spir[/eluser]
The other apps are loading 404 because they didn't find the default controller or your base_url is not properly set. What did you put in your config for those website? I'm gesssing they load controllers foo & bar. Or?
[eluser]DarKDinDoN[/eluser]
@Spir : The default foo & bar controllers are properly set. But not with a foo or bar controller ... @John_Betong : The sessions are not working for me as well ... Thanks for you replies
[eluser]Spir[/eluser]
[quote author="DarKDinDoN" date="1296581185"]@Spir : The default foo & bar controllers are properly set. But not with a foo or bar controller ... @John_Betong : The sessions are not working for me as well ... Thanks for you replies [/quote]Ok but what's in your config file? Base url?
[eluser]DarKDinDoN[/eluser]
Base url is set to http://www.example.com/ ... I can't let this var empty because it would break my entire app (links, images ...) If I let it empty, my base url would be: Code: http://www.example.com/foo/ but my assets are not located in: Code: http://www.example.com/foo/assets/ but in: Code: http://www.example.com/assets/ and I won't be able to use img, anchor functions anymore ...
[eluser]Spir[/eluser]
[quote author="DarKDinDoN" date="1296582872"]Base url is set to http://www.example.com/ ... I can't let this var empty because it would break my entire app (links, images ...)[/quote]That's what I'm talking about. If for instance : http://www.example.com/foo ---> should load the foo app You said the app is successfully loaded but a 404 is displayed. That app should be configured to base_url : http://www.example.com/foo/ Otherwhise that app looks for a controller called "foo" which doesn't exists. So it display a 404. Also you could hack this using hooks maybe or a specific route routine.
[eluser]DarKDinDoN[/eluser]
Ok ! I understand now I let you know if it works ^^ |
Welcome Guest, Not a member yet? Register Sign In |