将Laravel应用部署到Heroku时,链接不起作用

问题描述 投票:0回答:4

我获得了一个需要启动并运行的laravel项目。我是laravel的新手,但分配工作后,我相信我已正确配置了所有内容,并将此项目部署到了​​heroku。

[当我做工匠在laravel项目中的客户计算机上提供服务并转到给定的url时,所有链接均正常运行。但是我将其部署到了heroku,我的索引页面显示了,但是没有一个链接起作用。我得到:

Not Found The requested URL /register was not found on this server. 

似乎正在运行php artisan serve有点激活了链接,但是我如何在heroku上做到这一点?

我应注意该应用程序正在使用blade.php文件

我想念的是什么?

directory structure

这在/ resources / views中enter image description here

我的公用文件夹中的_htaccess如下

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

我尝试添加RewriteBase /没有帮助。我也尝试将htaccess更改为:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

而且我的Procfile有:

web: vendor/bin/heroku-php-apache2 public/

谢谢

php laravel heroku
4个回答
0
投票

好了,我解决了这个问题,看来我的web.routes路径中有一些小写字母那应该是大写字母。本地主机似乎不介意单词是否为大写,但linux确实介意....不确定是否会有所帮助,但我在很长一段时间内搜索了一些愚蠢的东西...


0
投票

我必须重新启动测功机才能运行,请运行heroku restart还要确保您的根目录中有一个Procfileweb: vendor/bin/heroku-php-apache2 public/


0
投票

我通过以下方式解决:

在config / app.php中

我更改为:

'asset_url'=> env('ASSET_URL','https://appcreated.herokuapp.com'),


-1
投票

我也有同样未解决的问题...尝试部署到heroku,加载主页,但链接返回未找到类的错误...尝试了相同的解决方法,包括更新heroku上的作曲家...抱歉,没有答案,但会喜欢关注这个话题

© www.soinside.com 2019 - 2024. All rights reserved.