Fix 404 error PHP

Job ID: 39932331

Budget: $30 – $250 USD

I'm experiencing a persistent 404 error after admin login in a CodeIgniter 4.5.0+ application on LiteSpeed server. The initial fix didn't resolve the issue, so I need deeper investigation.

Current Situation:

✅ Login works correctly at /admin/login
✅ Session saves successfully (using DatabaseHandler, verified in ci_sessions table)
✅ User gets redirected to /admin/services after login
❌ Both /admin/services AND /index.php/admin/services return 404
❌ This suggests routes aren't being registered at all, not just an .htaccess issue
What We've Tried (Didn't Work):

✅ Fixed AdminFilter.php to include proper return null; statements (verified 5 instances)
✅ Changed session handler from FileHandler to DatabaseHandler
✅ Modified AdminRoutes.php line 12 from config('AppConfig') to new \Config\AppConfig()
✅ Simplified .htaccess to match working development server
✅ Verified all route files exist and are syntactically correct
Critical Discovery:
Running diagnostic scripts shows:

✅ All files exist (AdminRoutes.php, ServicesController.php, etc.)
✅ AdminRoutes::init() is called in Routes.php (line 25)
✅ AdminFilter has correct implementation
✅ .htaccess has correct RewriteEngine rules
❌ Routes are NOT being loaded/registered - both URLs with and without index.php fail
This means the problem is likely:

AdminRoutes::init($routes) is being called but throwing a silent exception
The $routes object isn't being passed correctly
There's a namespace/autoloading issue preventing route registration
CodeIgniter's routing system isn't executing AdminRoutes::init() properly on LiteSpeed
What I Need You To Do:

Add error logging to AdminRoutes.php to see if init() executes:
Check if routes are actually registered by creating a debug endpoint:
Verify the route collection contains admin routes after AdminRoutes::init() is called

Check error logs on the server (usually in logs or server error log) for any exceptions during route loading

Server Details:

Server: LiteSpeed (shared hosting at Hostinger)
PHP: 8.2.29
CodeIgniter: 4.5.0+ (using new Boot.php, not deprecated bootstrap.php)
Database: MySQL with ci_sessions table verified working
Domain: purafama.cl (HTTPS enabled)
Files Already Modified (attached):

AdminRoutes.php - Changed to direct instantiation
App.php - DatabaseHandler for sessions
AdminFilter.php - Proper return statements
.htaccess - Simplified rules
Expected Behavior:
After login, user should access /admin/services successfully and see the services management page.

Actual Behavior:
404 error on ALL admin routes, including when accessed directly with index.php prefix.

Please investigate why routes aren't being registered and provide a solution. This is blocking the entire admin panel.

Let me know what you find in the logs and if you need FTP/SSH access to debug directly.

Thanks!
Related categories: PHP Website Design WordPress MySQL HTML