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

GKMelbo's avatar

Error 500 on sub-pages

I'm quite new to Laravel and are trying to set it up on shared hosting. So far I've managed to get the "Laravel 5" welcome message, but if I try to go to any sub-pages I receive a 500 internal server error.

This is what I have done: On the server, I have a /username/public_html folder. I installed Laravel on the same level as the public_html folder. Then I renamed my public_html folder to public_html_backup and created a symbolic link from /username/laravel/public to /username/public_html

After that, I added www. and https to the URL through my .htaccess file with these two lines:
RewriteCond %{HTTP_HOST} !^www.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Again, the welcome page displays properly, but as soon as I try a sub-page I get the 500 internal server error. I've been stuck with this problem for days and done my best to find an answer on Google, but with no luck. I'm hoping you guys can help me out. Let me know if you need any more information, and thanks in advance!

0 likes
1 reply
GKMelbo's avatar

Wow, that did it! Thank you so much, Prez! Since I'm new to most of this, could you explain why RewriteBase / fixed the problem?

EDIT: I just encountered another problem with the redirect.
If i go to mydomain.com it redirects me to https://www.mydomain.com which is what I want, and as I mentioned, it works to go to sub-pages from there thanks to the RewriteBase /
But if I try to go to mydomain.com/about the URL suddenly changes to the entire path to index.php in the public_html folder.
I have no idea why.

Solution: My bad, I figured it out! I had the rules at the bottom, not at the top. Once I moved them to the top directly after RewriteBase / everything works.

1 like

Please or to participate in this conversation.