2017-01-10 7 views
0

Slim FrameworkとApacheでアプリケーションが動作しません。 public_htmlの/スリム/はBiblioteca/Slim framework error apache

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

リターン:

ルートスリムは、同じ場所で使用とのindex.php(スリム)で

$app->group("/teste", function() { 
    $this->get("/", function(Request $request, Response $response, $args = []) { 
     return $response->write("deu"); 
    }); 

    $this->get("/:nome", function(Request $request, Response $response, $args = []) { 
     return $response->write("deu ".$args['nome']); 
    }); 
}); 

の.htaccessに動作していませんアクセスパスを試すときにエラー500/teste/

多分必要がありますhttpd.confを設定して作成し、.htaccessを有効にしますか?またAllowOverride All。/etcにあるこのファイル/

を見つけていない

は私を助けることができますか?

PrintScreenをプロジェクトリストファイル

enter image description here

+0

は500 –

答えて

0

は、.htaccessファイル内のコードの下に追加

RewriteEngine On 

Header add Access-Control-Allow-Origin "*" 
Header add Access-Control-Allow-Headers "origin, x-requested-with,content-type" 
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS" 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php [QSA,L] 

OR

は、たとえば以下のようなルートを定義します。

\Slim\Slim::registerAutoloader(); 

$app = new \Slim\Slim(); 

$app->post('/example', 'examplefunction'); 

私はそれが仕事に.htaccessファイル内のコードの下に

+0

が動作しない原因を確認するためにあなたのエラーログを確認してください動作しますが、THX助け –

+0

申し訳ありません問題はないため –

0

使用を願っていますし、それが

<ifModule mod_rewrite.c> 

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteRule ^(.*)$ index.php/$1 [NC,QSA,L] 

</ifModule> 
関連する問題