简体   繁体   English

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

[英]Slim Framework proper htaccess setup with wordpress

I want to make an api with slim. 我想做一个苗条的api。 it would be on my "tools" subdomain in a directory called api. 它将在我的“工具”子域中的api目录中。

http://tools.fifaguide.com/api

What should my .htaccess file look like? 我的.htaccess文件应该是什么样?

Currently my .htaccess is located in my Wordpress directory (html -> .htaccess), and it looks like this: 目前,我的.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> 

The problem with this is that when I try 问题是当我尝试

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

I imediately get redirected back to api/index.php instead of staying on /api/hello/steve and having the results shown. 我立即重定向回api / index.php,而不是停留在/ api / hello / steve并显示结果。

Its seems like wordpress is making this happen, but how do I prevent it? 似乎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