我正在玩Slim,它在运行MAMP的本地机器上运行良好。根URL显示“home”,/ features显示“features”。但是,在我的Linode机器上,只有root工作(“home”)。当我去/功能时,我得到了404。
<?php
//Slim Framework
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
//Instantiate, register URIs
$app = new \Slim\Slim(array(
'debug' => true
));
$app->get('/', 'getHome');
$app->get('/features', 'getFeatures');
$app->run();
function getHome() {
echo "home";
};
function getFeatures() {
echo "features";
};
?>
答案 0 :(得分:1)
原来我的.htaccess文件中没有打开mod重写。上传以下.htaccess解决了我的问题:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]