【发布时间】:2018-11-20 09:37:08
【问题描述】:
我不明白为什么 mvc 路由不起作用。
当我访问主页时,所有的css和js都被加载了。
"GET /css/main.css HTTP/1.1" 304
但是当我访问任何其他控制器时,我得到了:
method=GET path="/transaction/add"
[error] open() "/app/public/transaction/add" failed (2: No such file or directory)
"GET /transaction/add HTTP/1.1" 404
这是我的过程文件
--Procfile--
web: vendor/bin/heroku-php-nginx public/
location / {
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
try_files @heroku-fcgi @heroku-fcgi;
internal;
}
我真的迷路了。
【问题讨论】:
-
对不起,我使用 Apache,但这似乎是矛盾的:# rewrite all to app.php VS rewrite ^(.*)$ /index.php/$1 last;您可以尝试使用 app.php 而不是 index.php,或者使用 public/index.php
-
@KyleK,只是为了更新,我做了一些更改,但还没有。