Closed cesaribeiro closed 8 years ago
If you are getting an apache error, you did not follow the tutorial because it uses the built-in server. Sounds like an htaccess issue, but you are on your own here.
If you need help otherwise please try room 11 on stackoverflow
Oh you're right, I'm sorry... I forgot about that... I started the server with php -S localhost:8000
and it's working perfectly now!
Thank you!
Patrick, if you do not mind, can you point me in the direction of what should I do if I want to use apache for this project?
Haven't used Apache in at least 5 years, sorry. You need an URL rewrite that sends all requests to the front controller. Maybe look at how frameworks are doing it, they often come with a htaccess
I came across a similar issue for anyone in the same situation, where the slug pages were throwing a 404. Just remember to put a .htaccess file in the public folder with something like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Hello! First of all, thank you very much for this tutorial, it's great! I'm stuck at Part 10, I've added the router for the slug
['GET', '/{slug}', ['Example\Controllers\Page', 'show']]
and I've added thevar_dump($params);
on the Page.php file. But when I try to access http://localhost:8000/test but every time I get the Not Found apache error. What should I do?Thank you!