Routes not working after deploying Laravel 5 project into hosting
Asked Answered
A

4

8

I just uploaded my Laravel 5 proyect to the hosting server. The index page almost works, but every link is broken. Every single route returns an Internal Server Error message. This is the actual message:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I already set storage folder permissions to 777, but I don't even get an error log.

Any suggestions?

Actinal answered 12/4, 2015 at 5:52 Comment(5)
Read the server error logs and see what the actual error is...Geof
This may be url-rewriting issue. Have you followed this? laravel.com/docs/5.0#pretty-urls ?Guava
My hosting service does not supply error logsEquivocation
My .htaccess works perfectly for Laravel 4, but not for Laravel 5. I tried the instructions in your link, but it didn't workEquivocation
I had to destroy my .htaccess and fix it back in order to the server to make the update. Thank you all.Equivocation
A
19

In the end I could solve it adding

RewriteBase /

to my .htaccess file in the public folder.

This is my complete .htaccess file:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On
RewriteBase /

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

The most strange thing is I already had tried that, because that's how I solved the same issue with Laravel 4. What made it work was changing

RewriteBase /

to the incorrect

RewriteBase ../

and then changing it back to

RewriteBase /

And misteriously it solved.

I hope this helps anyone. It's 5:22 and I need some sleep

Actinal answered 12/4, 2015 at 10:24 Comment(4)
I am facing the same problem, tried this but not yet workingPhotochemistry
I am only able to view homepage but other routes showing 404 (Using Laravel at plesk)Photochemistry
you just described the problem of this post. Did you already edit your .htaccess?Equivocation
I used it as RewriteBase /admin-boilerplate for my laravel project hosted via alias in httpd.conf fileGenseric
F
1

First make sure .htaccess file exists in your public_html directory. Most uploads via zip on linux server will not automatically copy the .htaccess file since it is hidden.

Fib answered 20/7, 2019 at 13:50 Comment(0)
W
0

You will encounter this problem if you missing the .htaccess in public_html which is not included if you compres the project to .zip or others.

Wheal answered 20/7, 2019 at 1:37 Comment(0)
T
0

Best fix: put that in your .Htaccess

#redirect to the public folder RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]

Talented answered 29/8, 2024 at 19:27 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.