Jayden
Jayden

Reputation: 85

Code Igniter Project Folder

I have a code igniter project folder. Everything works fine. But when i placed the project folder in another folder as a sub-folder, i get 404 Page Not Found for the Controller URLS i called.

For instance the CI url is http://localhost/library Then i place it in another folder like : http://localhost/school/library

How do i solve this problem? I know its a directory problem. Thank you.

.htaccess file :

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

Structure of folder

    school/
          students/
          teachers/
          library/
                 application/
                 system/
                 assets/
                 index.php
                 .htaccess

The library folder is using code igniter frame work but the school folder which is the main folder is using no frame work.

Upvotes: 3

Views: 94

Answers (2)

Spoody
Spoody

Reputation: 2882

The problem is you are pointing to an index.php that is in your root folder, change that by using ./index.php instead.

Create a .htaccess file in your project folder with the following content:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]

You see the ./ part means Add the path to where .htaccess exists

Upvotes: 0

Terchila Marian
Terchila Marian

Reputation: 2520

create a file named .htaccess and put this code in

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L]

Upvotes: 1

Related Questions