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

时间:2017-05-31 03:03:26

标签: php laravel

1 将我的文件上传到000webhost。我将公共文件夹中的所有文件放到 public_html 然后我创建了一个名为 laravel 的文件夹,然后我上传了所有其他文件。这是我的目录的结构:

  

laravel

     
    

应用

         

自举

         

配置

         

...

  
     

的public_html

     
    

的index.html

         

.....

  

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

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

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

  •     
  

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

问题:

  

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

     
    

我该如何解决这个问题?

         

我如何访问api.php中的路线?

  

谢谢!

2 个答案:

答案 0 :(得分:3)

您的包含似乎很好。

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

答案 1 :(得分:0)

Try changing the index.php file. Change it as the following:

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

This should solve the problem.

相关问题