WordPress/Lumberjack-尝试访问路线时显示的404页



我正在使用Bedrock和Lumberjack开始使用,我正在尝试简单地获得一个" Hello World"示例。到目前为止没有成功。我添加了几条路线并创建了一个控制器,但是每当我去example.com/test或/hello-world时,我都会遇到404错误。

谁能帮我解决这个问题?

在我的WordPress主题routes.php文件中我有:

<?php
use RareloopLumberjackFacadesRouter;
use ZendDiactorosResponseHtmlResponse;
Router::get('Test', function () {});
Router::get('hello-world', function () {
   return new HtmlResponse('<h1>Hello World!</h1>');
});

我还创建了一个测试控制器:

<?php
namespace AppHttpControllers;
use RareloopLumberjackHttpController as BaseController;
class TestController extends BaseController
{
    public function __construct()
    {
        add_filter('wp_title', function ($title) {
            return 'TEST TITLE';
        });
    }
    public function show()
    {
        return 'Hello World';
    }
}

我遇到了相同的问题,我通过在项目文件夹的根中包含一个.htaccess来解决它:

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

最新更新