Slimframework 404问题

时间:2015-01-28 16:36:32

标签: apache .htaccess slim

我正在尝试使用Slimframework并且遇到一些麻烦。我的目录结构如下

/var/www/html
    rest
      .htaccess 
      index.php
      vendor
         composer
         slim

.htaccess包含以下内容

RewriteEngine On  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^ index.php [QSA,L] 

index.php如下

<?php
 require 'vendor/autoload.php';
 $app = new \Slim\Slim();
 $app->get('/hello/:name', function ($name) {echo "Hello, $name";});
 $app->run();
 //echo 'xx';
?>

当我浏览example.com/rest/index.php

我收到404错误。我确保我的Apache配置允许.htaccess,这不是问题。我认为我忽略了一些非常基本的东西,但我无法发现它。我非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

根据您尚未为/定义路线的事实,对example.com/rest/index.php/hello/droidexample.com/rest/hello/droid的请求应按预期工作。

相关问题