Pretty URLs won't work on localhost
Hi! I'd like to use pretty URLs on http://localhost or http://127.0.0.1. For example, I installed Laravel through composer and the starting page appears properly, but if I start making subpages, I will always get a 404 error. It's the same with other frameworks, too. If I use the "Auto virtual hosts" feature, than the subpages will load fine. The same thing happens both in Laragon 2 and 3 (regardless if it's Apache or nginx). What file should I change and how so that the subpages load properly? If I use XAMPP, I don't have this problem. Thanks for the help in advance.
The pretty urls of Laragon works like this: If you create your app in
www/app, you'll have
app.devworks without any issue.
I don't know why you need to use localhost or 127.0.0.1 as it is not pretty
@leokhoa It's not pretty that's true, but it can happen that I want to create a small app fast on a client's computer where I don't have administrative rights, so Laragon won't be able to edit the hosts file in the Windows folder.
@zmesi : I agree. Could you give me an example of a small app that don't work on Laragon but XAMPP using localhost?
Gotchas. I'll check and get back to you soon.
@leokhoa Thanks a lot.
@zmesi : I found the root cause with Apache. I will make a hot fix soon - will keep you posted.
You can check the file
C:\laragon\etc\apache2\sites-enabled\00-default.confand change the
<Directorydirective to your Document Root, then reload Apache.
<VirtualHost _default_:80> <Directory "C:/laragon/www"> AllowOverride All Require all granted </Directory> </VirtualHost>
@leokhoa: Thank you. Now it works under Apache well. I've checked the nginx config file, too (
etc\nginx\sites-enabled\00-default.conf), but couldn't modify it myself. There the Document Root seems to be good, but still the pretty URLs don't work on localhost.