[Solved] '/' Not found when using production mode. Debug mode, no problems

Hey guys,

I’m running into a very frustrating problem. I am using the bin/cake server to host the webserver for testing. If I set debug = false in my config/app.php, I get the following problem:

“Not Found
Error: The requested address ‘/’ was not found on this server.”

If I navigate to localhost:8765/login , my login page is shown… but not my homepage at localhost:8765

If I set debug = true, my application works flawlessly and my home page is shown. I’m not using apache at this time, I’m using the bin/cake server for testing purposes… What am I missing here? I’ve tried to install apache on my local ubuntu machine here, same issue. I must have spent the past 2 hours making sure my .htaccess files are correct (they are). So this isn’t an apache issue. Running Cakephp 3.1.

Thanks all,

I’ve found the issue!! When I started the project, I directly made a copy of home.ctp, then modified it and I forgot to remove the below section of code.

tldr;

Remove from your layouts…
if (!Configure::read('debug')): throw new NotFoundException(); endif;

1 Like