Laravel/00webhost错误404.在此服务器上找不到请求的URL

编程入门 行业动态 更新时间:2024-10-20 01:40:37
本文介绍了Laravel/00webhost错误404.在此服务器上找不到请求的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

1. 将我的文件上传到000webhost.我将所有文件从公用文件夹放置到 public_html ,然后创建了一个名为 laravel 的文件夹,并在那里上传了所有其他文件.这是我的目录的结构:

1. Uploaded my files to 000webhost. I placed all files from the public folder to public_html then I created a folder named laravel and there I uploaded all other files. This is the structure of my directory:

laravel

app

app

引导程序

config

....

public_html

index.html

index.html

.....

2. 在我的 index.php 文件中,我已经更改了一些内容

2. In my index.php file, I already changed some things to these

  • 需要 DIR .'/../laravel/bootstrap/autoload.php';

    • require DIR.'/../laravel/bootstrap/autoload.php';

      $ app = require_once DIR .'/../laravel/bootstrap/app.php';

      $app = require_once DIR.'/../laravel/bootstrap/app.php';

      3. 我还更改了laravel/config文件夹中的.env文件和database.php

      3. I also changed the .env file and the database.php in the laravel/config folder

      问题:

      我现在可以访问网站的主页,但是当我单击指向其他页面的链接时,会显示错误404.

      I am now able to access the home page of my site, but when I click my links to the other pages error 404 shows up.

      我该如何解决?

      How do I fix this?

      以及如何访问api.php中的路由?

      And how do I access the routes in my api.php ?

      谢谢!

      推荐答案

      您的包含项似乎还不错.

      Your includes seem fine.

      确保您还上传了位于/public(在/public_html中)的.htaccess文件.文件名以点开头,因此通常是隐藏的. 该文件的目的是指示Apache如何将URL映射到实际文件(在这种情况下,所有内容都应指向index.php)

      Be sure you also uploaded the .htaccess file located in /public (in your /public_html). The file name starts with a dot so it's commonly hidden. The purpose of this file is to indicate Apache how to map URLs to real files (in this case, everything should point to index.php)

更多推荐

Laravel/00webhost错误404.在此服务器上找不到请求的URL

本文发布于:2023-10-31 15:59:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546571.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:在此   找不到   器上   错误   Laravel

发布评论

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

>www.elefans.com

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