Slim Framework适当的htaccess设置与wordpress

Ste*_*tay 2 php wordpress .htaccess mod-rewrite slim

我想用苗条做一个api.它将出现在名为api的目录中的"tools"子域中.

http://tools.fifaguide.com/api
Run Code Online (Sandbox Code Playgroud)

我的.htaccess文件应该是什么样的?

目前我的.htaccess位于我的Wordpress目录(html - > .htaccess),它看起来像这样:

<IfModule mod_rewrite.c>

//my part
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/api/index.php
RewriteRule ^api/(.*) http://tools.fifaguide.com/api/index.php [L]

//wordpress part
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]

</IfModule> 
Run Code Online (Sandbox Code Playgroud)

这个问题是我尝试的时候

 http://tools.fifaguide.com/api/hello/steve
Run Code Online (Sandbox Code Playgroud)

我立即被重定向回api/index.php,而不是留在/ api/hello/steve并显示结果.

似乎wordpress正在实现这一点,但我该如何防止呢?

Ste*_*tay 5

<IfModule mod_rewrite.c> 
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/api/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ api/index.php [QSA,L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]
</IfModule>  
Run Code Online (Sandbox Code Playgroud)