【发布时间】:2018-03-11 07:18:47
【问题描述】:
RewriteEngine On
RewriteBase /buildzone_admin/
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
以上是我的 Htaccess 路由代码。
<?php
$main = require __DIR__ . '/lib/base.php';
$main->set('AUTOLOAD', 'inc/');
F3::set('CACHE', false);
F3::set('DEBUG', 3);
F3::set('UI', 'ui/');
$main->route('GET /', 'index');
$main->route('POST /show', 'Test->show');
$main->route('POST /loginCheck', 'BuildzoneAuth->authenticate');
F3::set('DB', new DB(
'mysql:host=localhost;port=3306;dbname=sunkomen_buildzone',
'123', '123'
)
);
function index()
{
F3::set('modules', array(
'apc' =>
'Cache engine',
'gd' =>
'Graphics plugin',
'hash' =>
'Framework core',
'imap' =>
'Authentication',
'json' =>
'Various plugins',
'ldap' =>
'Authentication',
'memcache' =>
'Cache engine',
'mongo' =>
'M2 MongoDB mapper',
'pcre' =>
'Framework core',
'pdo_mssql' =>
'SQL handler, Axon ORM, Authentication',
'pdo_mysql' =>
'SQL handler, Axon ORM, Authentication',
'pdo_pgsql' =>
'SQL handler, Axon ORM, Authentication',
'pdo_sqlite' =>
'SQL handler, Axon ORM, Authentication',
'session' =>
'Framework core',
'sockets' =>
'Network plugin',
'xcache' =>
'Cache engine'
)
);
echo Template::serve('index.htm');
}
F3::run();
?>
以上是我的 php 代码。 问题是当我尝试访问任何文件时显示 404 文件未找到。
示例:
domain.com/buildzone_admin/
然后它工作正常。
但是
domain.com/buidzone_admin/logincheck
然后它说 404 File not found 并且对于任何类型的方法 GET 或 POST 都是相同的。它不工作。
请让我知道我缺少什么。
【问题讨论】:
-
同时检查类是否存在于 lib/
-
@LawrenceCherone 是的,我已经定义为 POST 方法。
-
检查是否为您的 apache 服务器主机配置设置了“AllowOverride All”;)