0
votes

I just copied a codeigniter project from one folder to another in my XAMPP htdocs. These two projects contain exactly the same code, they're just in different directories.

In the copied project, the default_controller works fine but none of my routes work.

my routes:

$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['dashboard'] = 'dashboard';

The index file is located at localhost/project/www

If I go to localhost/project/www/dashboard, I get a 404.

But if I do this:

$route['404_override'] = 'dashboard';

Then the dashboard controller loads correctly when I go to localhost/project/www/dashboard (or any other path, which would give a 404, of course)

The problem is not in the .htaccess file, since it's just generic:

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

Like I said, the code has just been copied from one directory to another. Any ideas as to what is preventing my routes from working properly? Have I missed something?

EDIT

After setting the 404_override and removing it again, the routes magically worked again. Everything is fine.

If anyone could shed a light on why this has happened, that might help the next guy who gets in this situation. But for me, the problem is resolved.

2

2 Answers

0
votes

OK, the problem was that I had used uppercase for the name of the copied project, but was trying to access it with lowercase on a system that discerns between these two.

So, stupid

0
votes

i think problem is you were using doing like this

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

instead you try it

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