CodeIgniter Forums
CI3 - place index not in top directory [SOLVED] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: CI3 - place index not in top directory [SOLVED] (/showthread.php?tid=82181)



CI3 - place index not in top directory [SOLVED] - TheAdmiral - 06-22-2022

Hey there. I've got a couple different places I put my CI3 website. One of them (a version I use for testing) is at http://localhost/Folder1/Folder2/Folder3/. Having all those folders between localhost and the index.php file is confusing CodeIgniter and is resulting in it detecting the class as Folder1 and the method as Folder2.

So for example http://localhost/Folder1/Folder2/Folder3/class/method should be [class=class, method=method], not [class=Folder1, method=Folder2]

Is there a way to fix this without changing my directory structure? Help much appreciated.


RE: CI3 - place index not in top directory - SubrataJ - 06-22-2022

(06-22-2022, 04:58 AM)TheAdmiral Wrote: Hey there. I've got a couple different places I put my CI3 website. One of them (a version I use for testing) is at http://localhost/Folder1/Folder2/Folder3/. Having all those folders between localhost and the index.php file is confusing CodeIgniter and is resulting in it detecting the class as Folder1 and the method as Folder2.

So for example http://localhost/Folder1/Folder2/Folder3/class/method should be [class=class, method=method], not [class=Folder1, method=Folder2]

Is there a way to fix this without changing my directory structure? Help much appreciated.
What's your base URL?


RE: CI3 - place index not in top directory - TheAdmiral - 06-22-2022

$config['base_url'] = 'http://localhost/Marathon%20Volunteers/BitBucket/dev.titanvolunteers.com/';


RE: CI3 - place index not in top directory - SubrataJ - 06-22-2022

(06-22-2022, 05:10 AM)TheAdmiral Wrote: $config['base_url'] = 'http://localhost/Marathon%20Volunteers/BitBucket/dev.titanvolunteers.com/';

your base URI is pretty much confusing, but as per your folder structure given by you, your base URL should be " http://localhost/Folder1/Folder2/Folder3/" for the project inside folder3.

if you have a git repo it would be much easier to assist.

and it's not a good practice to use space in a URI as a URI must not contain a literal space and must be encoded; a %20 is not a space but it represents a space.


RE: CI3 - place index not in top directory - InsiteFX - 06-22-2022

Show your folder structure

index.php
-- application
-- system

You need to tell index.php where your application and system folders are located.


PHP Code:
index.php

// Normal folder structure
$system_path 'system';

$application_folder 'application';

// Custom folders structure
$system_path '../system';

$application_folder '../application';

.. 
up one folder 



RE: CI3 - place index not in top directory - TheAdmiral - 06-22-2022

localhost
--Marathon Volunteers
----BitBucket
------ci_dev
--------application
----------cache
----------config
----------controllers
----------etc.
--------test
--------vendor
----------codeigniter
------dev.titanvolunteers.com
--------index.php

$system_path = '../ci_dev/vendor/codeigniter/framework/system';
$application_folder = '../ci_dev/application';


RE: CI3 - place index not in top directory - TheAdmiral - 06-22-2022

Got it. That space in the folder `Marathon Volunteers` was the cause of the bug. Renaming the folder to MarathonVolunteers fixed it. Thanks all for the ideas.


RE: CI3 - place index not in top directory - InsiteFX - 06-23-2022

I saw the space yesterday and was going to mention it to have you try changing it.

Please edit your post title and add [SOLVED] to the end of it.

Thank you.