简体   繁体   中英

Slim Framework proper htaccess setup with wordpress

I want to make an api with slim. it would be on my "tools" subdomain in a directory called api.

http://tools.fifaguide.com/api

What should my .htaccess file look like?

Currently my .htaccess is located in my Wordpress directory (html -> .htaccess), and it looks like this:

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

Its seems like wordpress is making this happen, but how do I prevent it?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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