将laravel 8迁移到共享主机后出现错误404 [英] Error 404 after migrating laravel 8 to a shared host

查看:78
本文介绍了将laravel 8迁移到共享主机后出现错误404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我是laravel的新手,我希望有人能帮助我解决我的问题.我创建了一个laravel项目.之后,我使用softaculous将其导入cpanel.然后,我根据网上的研究进行了一些更改,以避免显示.env之类的重要文件.我创建了一个相对于public_html的文件夹,可以说文件夹名为"tamangbilang",除了index.php之外,我几乎放了所有代码.在我的public_html文件夹中,我的index.php驻留在另一个文件夹中,名为"tamangbilang".我已按照此说明 https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj 的唯一区别是我在public_html内放置了另一个文件夹.我还对index.php代码做了一些更改

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.

似乎路线之间的连接已丢失.我进行了进一步的测试,我注意到只有在URL中的路由之前有index.php的情况下,代码才能正常工作.例子

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.我无权使用ssh.

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

推荐答案

转到引导文件夹&打开缓存文件夹,然后删除配置.之后,请检查您的路由,此错误基本上是由于找不到路由而发生的,该路由转到安装在本地的项目并编写php artisan route:列出检查该路由是否存在.

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.

这篇关于将laravel 8迁移到共享主机后出现错误404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆