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

attila.kom's avatar

500 Error when trying to load any view besides the home/index view.

Hey everyone. So I uploaded a Laravel website on a Namecheap server here: https://kdev.solutions/ and it works fine. I uploaded again (essentially the exact same files, except for some minor changes like setting APP_URL for the new domain, etc.) to another Bell server here: http://anomet.com/ and now I get an "Internal Server Error" (on the Bell serer) whenever I try to navigate to a different page. Not sure how I could go about fixing this problem.

Server logs are empty :( I'm using Laravel 5.4.15

0 likes
22 replies
attila.kom's avatar

I just tried replacing the .htaccess file with what you linked, it didn't fix the problem :(

acorbeil's avatar

I mean, maybe the module mod_rewrite is not "activated". Maybe you can check in this direction. I'm not a server expert so I can't help you on that but I had that kind of problem because of this.

mushood's avatar

Hello

I had the same issue and the solution for me was to clear cache.

Add this code in your web.php file in the routes folder if you dont have access to command line.

Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return 1;
});

hope this helps

attila.kom's avatar

@mushood I don't have access to the command line :( and I can't hit the /clear-cache route to run that block of code because I get the internal error if I try to navigate to any page/ route.

@acorbeil Okay, I'll look into how to activate it.

Thanks for the responses so far guys!

EDIT: I do have SSH access, so I'll try clearing cache and let you know how it goes. UPDATE: I just get "php command not found" when I try to run a php artisan command.

mushood's avatar

@attila.kom Hello, if you have an SSH access, I suppose you already ran composer update ?

UPDATE: Also, try adding going to your URLs like this: www.domain.com/index.php/urlName

1 like
mushood's avatar

Hello

Check this out: https://laravel.io/forum/09-15-2015-removing-indexphp-from-url-laravel-5116

Worked for me here: https://stackoverflow.com/questions/44112404/laravel-routing-returning-404-without-using-index-php

As for the images, inspect the URL. You will see that it added the "index.php" as well in the link. Since the path is incorrect, the image is not loaded. For those who are, there should be no index.php

Side note: Cool website. I really like the design :)

1 like
attila.kom's avatar

@mushood Thanks! The only problem is that I can't find a .conf file :/

EDIT: I've sent a request to Bell to hopefully have them fix the issue. Right now it seems I don't have access to all the files. When I connect via FTP or SSH I can see things like the public folder and Laravel files that I uploaded but nothing that looks anything close to a config file where I can activate mod_rewrite.

sigh I really wish the client didn't choose Bell for their hosting :/

1 like
mushood's avatar

Keep this thread updated please. I'd really like to know if that was the correct solution. I am trying to think of a hack, something like if you catch a URL without index.php ,just add it. Of course as a short term solution. But the problem I guess is that its not even catching the URL.

Could something like this do the trick:

Route::get('/../lighting', function () {
    return redirect('/index.php/lighting');
});
attila.kom's avatar

I'll post an update once I hear back from Bell. I'll try that new route when I'm home again tomorrow and let you know if it works.

1 like
ninka_kukla's avatar

if you dont have access to the server itself, but you need to run some shel commands you can use shell_exec() function.

here is a route that should fix your problem, because usually the problem your`e facing its a storage permission problem.


 Route::get('/chmod', function() {
    $output = shell_exec('sudo chmod -R 775 /var/www/html/storage');
    return "Chmoded";
}); 

of course, there is a need to know the correct path to your project in the server

'sudo chmod -R 775 /path/to/the/project/storage'

the command that i gave you, give permissions to the storage folder and all the sub folders and files in it:

sudo - allows you to run commands as superuser (or any other user, but as default it will give the permissions of superuser)

chmod - command that change permissions

-R - recursively (if you will remove it, it will change the permissions only to the storage folder (without touching the sub folders and files in them)

775 - It makes all files and directories readable and executable for everyone, and writeable for the owner and anyone who is in the same group as the group owing a file.

and i wouldn't recommend to use the shell_exec for commands that you don`t know, or to change configurations on the server without knowing what are you doing.

hope it will help! :-)

1 like
attila.kom's avatar

@mushood So I called Bell (took forever to get through to a tech support person, and emailing them is absolutely useless) and he asked his supervisor who said mod_rewrites should already be enabled. I told him the symptoms I'm having suggest that it's not enabled, but there was basically nothing he could do :/ absolute shit support. I'll call them back later, I'm just wondering if there's anything else I could do...

attila.kom's avatar

@Ibbe Thanks for the reply, unfortunately the answers there did not work :( no matter what I put in my .htaccess or where I put it, it doesn't help. Neither does renaming/ moving folders to different locations like mentioned in the answers. I'm starting to believe that mod_rewrite is not enabled like Bell told me it is...

mushood's avatar

Shooting in the dark, one of the issues I had before was that there was the wrong php version on my hosting. Maybe check that. Otherwise, I am stumped. I'll keep thinking though.

ronbarhash's avatar

Hi, if you just moved the files to another server and nothing works.

Turn on the debugging mode in the configuration and go into the development mode ... In this case, you will see a more detailed error log. It will be clear where you made a mistake.

Snapey's avatar

if the pages load when you route them via index.php then it is NOT

  • a problem with cache
  • a permissions error
  • the wrong php version

all of the above would result in 500 errors, which is not what you are complaining about

the issue is most likely .htaccess/mod_rewrite - as you have been following

Your web server should notice that you are accessing a non existent file or directory and rewrite the page with the original request to index.php where the laravel bootstrapper takes over

Just checking though that you have maintained the default directory structure and that .htaccess and index.php are in the public folder

Also noted, the 500 error is not from Laravel

3 likes
acorbeil's avatar

@attila.kom, like my first answer I'm pretty sure your problem is mod_rewrite. I just had the same problem. Url.com/login did not work but url.com/index.php/login was working.

I have enabled mod_rewrite (a2enmod rewrite) and restarted apache (apache2 service remaining) and now url.com/login and the other routes are working but you need a sudo user to do that.

@snapey gives the best explanation why is mod_rewrite. Let us know if you find your problem!

attila.kom's avatar

Thanks for the replies everyone! I've been away for awhile so sorry for the delay in getting back. I'll get a chat with Bell again tomorrow. The version of PHP on the server is 5.6.23, and I noticed that the Laravel docs mention I need 5.6.4 or greater, so I'll have to ask Bell if they can update the version for me. I'll try to clear the cache too, just to be safe. And if I'm still having issues then I'll have to give Bell shit for telling me mod_rewrites was enabled (without even checking if it actually was).

@Snapey Index.php and .htaccess are in the public directory. Also, I'm a little confused, the 500 error is not from Laravel, but I'm still getting a 500 error (http://anomet.com/aluminum), so doesn't that mean that wrong PHP version and/or cache could be the culprit as well?

Snapey's avatar

because you say your code works when routed through index.php

1 like
attila.kom's avatar
attila.kom
OP
Best Answer
Level 1

Hey, so I actually changed the .htaccess to the following, and now it works:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Please or to participate in this conversation.