Router is only showing index page and other routes are not working

I’m on a localhost server. Only the index page for my router is showing, but when I try to go to the about.php and contact.php pages I made, this error message appears ‘The requested resource /contact.php was not found on this server.’. I’m supposed to get this error message though if my route doesn’t work ‘throw new Exception(‘No route defined for this URI.’);’. I’ve been following a tutorial to make this and I’m not sure how to debug this.

This is my index.php file

<?php

require 'core/bootstrap.php';

require Router::load('routes.php')
    
    ->direct(Request::uri());

It’s supposed to load the router and direct it to the correct php file.

here is a router object with links. Only the ‘’ => controllers/index.php link is working correctly.

<?php

$router->define([

    '' => 'controllers/index.php',

    'about' => 'controllers/about.php',
    
    'contact' => 'controllers/contact.php'
]);

This is a Router class to load the router object and use the links from it to go to the correct file.

<?php

class Router
{
    protected $routes = [];
   
    public static function load($file)
    {
        $router = new static;

        require $file;

        return $router;
    }
    public function define($routes)
    {
        $this->routes = $routes;
    }
    public function direct($uri)
    {
        if (array_key_exists($uri, $this->routes)) {
           
            return $this->routes[$uri];
        }
       
        throw new Exception('No route defined for this URI.');
    }
}

This class takes the request_uri from the page and uses it to get to the correct file with the router class.

<?php

class Request
{
    public static function uri()
    {
        return trim($_SERVER['REQUEST_URI'], '/');
    }
}

And this file takes everything connects all the files together.

<?php

$app = [];

$app['config'] = require 'config.php';

require 'core/Router.php';

require 'core/Request.php';

require 'core/database/connection.php';

require 'core/database/queryBuilder.php';

$app['database'] = new QueryBuilder(

    Connection::make($app['config']['database'])
    
);

I’d appreciate any help with this. Here is a link to the project on github https://github.com/aioy/firstBlog

I found the error. In my views file I had to change my tag href link from ‘about.php’ to just ‘/about’, and now its working.

class NestController extends BaseController {

public function showView()
{
    return View::make('nest');
}

}
Route:

Route::get(’/nest’, ‘NestController@showView’);
When I go to url/nest it doesnt work. When I go to url/index.php/nest it does work.

Obviously I just want it to be /nest without the index.php.
you can try it, if you face this problem.

If you are using Belkin router and face any problem with this router visit here
belkin router Support

I can’t really provide general support for things so far outside the content of the course, but one quick thing that might get you pointed in the right direction For more contact HP Support

we all recognize that Brother printers are extraordinarily relaxed and compactable printing tool Brother printers are assist you to find out your work productiveness through its wi-fi networking talents. If you are searching Customer Care Support Services to your printer then you can visit our web sites. Thanks how to connect brother printer to wifi

I didn’t know much about these routers, but I was always interested in how they work, so I asked a friend about their work and, in general, about their effectiveness. I was shocked how they can work. Routers can also depend on their addresses. I was also delighted that you can change the address for routers. Increase my efficiency in a couple of moments … After this news, I quickly became interested in this whole matter. I got carried away with routers and their addresses. Thanks to a friend who helped with the efficiency of the wifi and the serviceability of the bad wifi. He also advised me the address for the routers. I have not seen such an effective address for a router, use 192.168.8.1