繁体   English   中英

使用Wordpress的Slim Framework正确的htaccess设置

[英]Slim Framework proper htaccess setup with wordpress

我想做一个苗条的api。 它将在我的“工具”子域中的api目录中。

http://tools.fifaguide.com/api

我的.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> 

问题是当我尝试

 http://tools.fifaguide.com/api/hello/steve

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

似乎wordpress正在使这种情况发生,但是我该如何防止呢?

<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>  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM