Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

munirmdee's avatar

Routing not working with xampp

Hello guys, I have a php file name "index.php", I wrote this codes inside:

I place the folder "test" in the folder "htdocs", but when I run it does not work, but if I run using:-

php -S localhost:8080 in the dos prompt it works fine.

Can someone help me why is not working with xampp?

0 likes
1 reply
munirmdee's avatar

This is the syntax: $routes = [ 'test' => 'pages/home.php', 'test/home' => 'pages/home.php', 'test/about' => 'pages/about.php', 'test/contact' => 'pages/contact.php' ]; require $routes[$path];

Please or to participate in this conversation.