将laravel 8迁移到共享主机后出现错误404

编程入门 行业动态 更新时间:2024-10-28 14:30:47
本文介绍了将laravel 8迁移到共享主机后出现错误404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,我是laravel的新手,我希望有人能帮助我解决我的问题.我创建了一个laravel项目.之后,我使用softaculous将其导入cpanel.然后,我根据网上的研究进行了一些更改,以避免显示.env之类的重要文件.我创建了一个相对于public_html的文件夹,可以说文件夹名为"tamangbilang",除了index.php之外,我几乎放了所有代码.在我的public_html文件夹中,我的index.php驻留在另一个文件夹中,名为"tamangbilang".我已按照此说明 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 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

my-sample-domain/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

本文发布于:2023-11-14 14:46:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587570.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:出现错误   主机   laravel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!