Similar here https://laracasts.com/discuss/channels/general-discussion/php-for-beginners-page-not-found-using-wampserver
Of course there's differences in Apache and nginx.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to create new php only project using Laragon. My pretty url is working first.test and it loads the home page of the project. I am getting 404 error when I try to use first.test/contact or first.test/about page. Browser hits index.php only for the first.test for other two cases I am getting 404. I can see following entry in my host file automatically done. 127.0.0.1 first.test #laragon magic! 127.0.0.1 node_modules.test #laragon magic!
My virtual host entry looks like following <VirtualHost *:80> DocumentRoot "C:/laragon/www/first" ServerName first.test ServerAlias *.first.test <Directory "C:/laragon/www/first"> AllowOverride All Require all granted </Directory> </VirtualHost>
Following is my code for index.php require 'functions.php'; $uri = parse_url($_SERVER['REQUEST_URI'])['path']; //var_dump($_SERVER['REQUEST_URI']); die(); $routes = [ '/' => 'controllers/index.php', '/about' => 'controllers/about.php', '/contact' => 'controllers/contact.php', ];
if (array_key_exists($uri, $routes)) {
require $routes[$uri];
}
Please help me to solve routing problem for other pages like first.test/contact
Thank you,
Please or to participate in this conversation.