• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URLs don't work when application is in web root

#1
[eluser]Unknown[/eluser]
I'm rewriting this to clarify:

I'm confused about how, if the application folder is not in the usual location inside the base_url folder, the techniques described in the documentation for navigation are supposed to work. Or at least, they aren't working for me. I put my app and system above the web root and redirected to them, because the installation instructions say:
Quote:For the best security, both the system and any application folders should be placed above web root so that they are not directly accessible via a browser.
… and, while I'm at it, the User Guide says this can be done at http://ellislab.com/codeigniter/user-gui..._apps.html:
Quote:If you would like to rename your application folder you may do so as long as you open your main index.php file and set its name using the $application_folder variable
It is possible to move your application folder to a different location on your server than your system folder. To do so open your main index.php and set a full server path in the $application_folder variable.
$application_folder = "/Path/to/your/application";
So that is what I did: I set my system and application folders above the web root, and made my system and application variables
Code:
$application_folder = ‘/wamp/codeigniter/application’;
$system_path = ‘/wamp/codeigniter/system’;
And the first page works just fine. But standard navigation (as described in the tutorial) does not: I get Not Found. The URLs are all still looking for files relative to the base_url. I followed the tutorial, creating a home page and appending '/index.php/view/pages' to my URL and – 404. I then altered the controller code from this:
Code:
if ( ! file_exists('application/views/pages/'.$page.'.php')) {
to this
Code:
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))

And the navigation DID work. I don't see this anywhere in the documentation however, which makes me think this isn't the right way to go about it.
For that matter, how would a simple href URL work? Any tip or advice much appreciated.


Messages In This Thread
URLs don't work when application is in web root - by El Forum - 10-03-2012, 01:31 PM
URLs don't work when application is in web root - by El Forum - 10-03-2012, 09:39 PM
URLs don't work when application is in web root - by El Forum - 10-04-2012, 03:25 AM
URLs don't work when application is in web root - by El Forum - 10-04-2012, 05:07 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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