The requested URL was not found on this server


#1

Hi,

I’m having an issue with my cakephp project. Anytime I try to access a page other than my login page, I get The requested URL was not found on this server. From my login page, I try to redirect to an action in another controller using:
return $this->redirect([‘controller’ => ‘Home’, ‘action’ => ‘index’]); For some reason, it doesn’t work though. I have checked my .htaccess files and changed the documentroot to the top of the project, but nothing works.

Can anyone help me with this issue?


#2

It can mean several things. Do you have your HomeController.php in the right place?


#3

Yes. Its in the src/Controller folder


#4

Than check the following.

  1. Try to access an url what do not requires authentication (so itcan be accessed without login)
  2. If you have a default url to where the user is redirected after login, it may be non existent.
  3. You may have a route what is overlapping with some redirects.

Switch on debug and share your error message.


#5

Well, my login page is my base path, and that shows up with no problem. If I use the default base path that comes with cakephp, it works fine. There just seems to be an issue with accessing any other page whether through redirect or typing in the URL myself. Also, my authentication is only done in a controller I created. It’s not using the cakephp Auth system.

The URL definitely exists. I created not only the controller and the action that its being directed to, but also the ctp file that it’s supposed to display.

The only route I have is the base path route.