0

我正在玩 Slim,它在我运行 MAMP 的本地机器上运行良好。根 URL 显示“home”,/features 显示“features”。然而,在我的 Linode 机器上,只有 root 可以工作(“home”)。当我转到 /features 时,我得到一个 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";
};

?>
4

1 回答 1

1

原来我没有在我的 .htaccess 文件中打开 mod rewrite。上传以下 .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]
于 2012-12-01T20:53:03.890 回答