Reputation: 85
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
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
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