URLs don't work when application is in web root |
[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 variableSo 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’; Code: if ( ! file_exists('application/views/pages/'.$page.'.php')) { 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.
[eluser]Aken[/eluser]
Your modification is correct - the tutorial assumes you're using CodeIgniter as it comes out of the package, and not modifying paths or folder names. You can also check if your index.php specifies the VIEWPATH constant (I don't remember what version it was added in - might only be in the dev 3.0 version). If it has that, you can use that constant instead to make things even more simple.
[eluser]Unknown[/eluser]
Thanks Aken for confirming about the tutorial and that I'm at least on the right track with the modification. I don't see the VIEWPATH, so it must be in the unreleased build. One more question: how can I adapt navigation such as the below if the application isn't in the site's directory: Code: <a href="pages/view">Go to a page</a>
[eluser]Aken[/eluser]
Not 100% sure I'm understanding your question exactly, but you'd use routes to direct a non-existant URL to a valid class/method/id URI. You can also use the URL helper functions site_url() or anchor() to generate URLs that include index.php automatically. Which is good for if you remove index.php via .htaccess in the future. |
Welcome Guest, Not a member yet? Register Sign In |