这在我的WAMP服务器上运行,但是当我尝试在我的主机上使用它时总是会出错:
HTTP 404 (GET /)
• teste/index.php:17 Base->run()
您可以在此处看到错误:http://rafaelmsantos.com/teste/
我不知道有什么事情发生,我尝试过不同的.htaccess,但它总是显示相同的错误。
.htaccess
# Enable rewrite engine and route requests to framework
RewriteEngine On
# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
# RewriteBase /
RewriteRule ^(lib|tmp)\/|\.(ini)$ - [R=404]
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
的config.ini
[globals]
AUTOLOAD=public/pages/
DB.dns="mysql:host=localhost; dbname=lod; port=3306;"
DB.user="root"
DB.password=""
DEBUG=3
UI=assets/
的index.php
<?php
$lod = require('lib/base.php');
$lod->config('config.ini');
// HELPERS DEVELOPED BY ME
require_once 'helpers/base_helper.php';
//*-----------------------------------------------------------------*/
//* PÁGINAS */
//*-----------------------------------------------------------------*/
$lod->route('GET /', 'PagesController->index');
$lod->route('GET /project/@page', 'PagesController->index');
$lod->run();
我的文件夹结构:
答案 0 :(得分:1)
尝试在.htaccess中设置RewriteBase(如上面的评论所述):
RewriteBase /teste/
答案 1 :(得分:0)
原来我必须以另一种方式自动加载,
而不是config.ini上的AUTOLOAD=public/pages/
,我必须在$lod->set('AUTOLOAD','public/pages/');
之后和路线之前使用require_once
。