definitely your hosting should be configured to serve the folder containing index.php and your .htaccess as what is known as the document root
Google setting document root in MAMP
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all,
I'm following the PHP Practitioner course, but experience difficulties to set up my router according to ep. 16.
I tried to configure the .htaccess file in multiple different ways, to no avail. Keep getting the error:
"Fatal error: Uncaught Exception: No route defined for this URI in /Applications/MAMP/htdocs/laracast/PDO/c_routing/core/router.php:30 Stack trace: #0 "
I though it might have something to do with my path for the project in (mamp) htdocs (/laracast/PDO/c_routing/), but can't figure out what I'm doing wrong.
This is one of my attempts (probably focussing to much on the path...). Anyone that can help me understand what I'm doing wrong?
Thank you in advance!!
.htaccess file :
RewriteEngine On
RewriteBase /laracast/PDO/c_routing/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /laracast/PDO/c_routing/index.php [L]
more info (folder structure / scripts ) : https://imgur.com/a/KzL0odh
// UPDATE //
$uri = string(22) "laracast/PDO/c_routing
routes array = array(4) { [""]=> string(21) "controllers/index.php" ["about"]=> string(21) "controllers/about.php" ["about/culture"]=> string(29) "controllers/about-culture.php" ["contact"]=> string(23) "controllers/contact.php" }
Based on the dump above, a friendly redditor advised me to remove the prefix from $uri. Which resulted in no more error but just a blank screen (instead of the index) :-D (laughing but actually crying a little) I think I just postponed the issue no? Or would it have another reason for blank screen
Please or to participate in this conversation.