Error 404 after migrating laravel 8 to a shared host
Asked Answered
G

1

1

Hello everyone i am new to laravel and i hope someone can help me about my problem. I created a laravel project. After that I import it to cpanel using softaculous. Then, I made some changes base on what i research in the net to avoid showing important file like .env . I created a folder relative to public_html, let say the folder name is 'tamangbilang' where i put almost all of my code except the index.php. Inside my public_html folder, I have another folder named as 'tamangbilang' where my index.php resides. I have followed this instruction https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj the only difference is that I put another folder inside public_html.I also did some changes on the index.php code

require __DIR__.'/../../tamangbilang/vendor/autoload.php';
$app = require_once __DIR__.'/../../tamangbilang/bootstrap/app.php';

Everything is working fine on my login page(my first page) but when I try to login, an error occur.

The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

It seems like the connection between routes was lost. I did further testing and I notice that the code is working well only if there is an index.php, before the route in the url. example

http://my-sample-domain.org/tamangbilang/index.php/login

P.S. I don't have access for ssh.

Garrote answered 16/3, 2021 at 0:33 Comment(3)
If this worked on dev machine with windows please check your spellingOrvilleorwell
Please share last line of log file beside index.php if there are new logsOrvilleorwell
In my cpanel i have terminal so i can run php artisan like ssh with web accessOrvilleorwell
S
1

go to bootstrap folder & open cache folder then delete config. after that please check your routes this error basically arises due to routes not found for that go to your project installed on local and write php artisan route: list check if the route is present or not.

Spindrift answered 16/3, 2021 at 0:42 Comment(1)
Thanks mate but I already deleted this file before.Garrote

© 2022 - 2025 — McMap. All rights reserved.