[英]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.