简体   繁体   English

使用Slim Framework的htaccess的mod重写问题

[英]mod rewrite issue with htaccess using Slim Framework

im working on a app for a client in which they have a site with a few wordpress blogs on it http://www.chasethepaper.com 我正在为客户开发应用程序,他们在该网站上拥有一些wordpress博客, 网址为http://www.chasethepaper.com

in the root, the htaccess file is 在根目录中,htaccess文件是

<IfModule mod_rewrite.c>
RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_URI} !^/(yumninja_app_1_0|yumninja_app_1_0/.*)$
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>

inside the root, i have a folder called 在根里面,我有一个名为

'yumninja_app_1_0'

inside the 'ap' folder i have an htaccess with 在“ ap”文件夹中,我有一个htaccess

if you go to http://chasethepaper.com/yumninja_app_1_0/api/ 如果您访问http://chasethepaper.com/yumninja_app_1_0/api/

it shows the index page, which is correct however, if you go to 它会显示索引页面,但是如果您转到

http://chasethepaper.com/yumninja_app_1_0/api/getReviews it returns the wordpress 404 http://chasethepaper.com/yumninja_app_1_0/api/getReviews它返回wordpress 404

Here is the htaccess file inside the api folder 这是api文件夹内的htaccess文件

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess filwe.
#
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(yumninja_app_1_0|yumninja_app_1_0/.*)$
RewriteRule ^(.*)$ index.php [QSA,L]

<IfModule Mod_php.c> 
 php_value upload_max_filesize 10M
 php_value post_max_size 20M
 php_value memory_limit 32M
</IfModule>

im really not sure why this is not working. 我真的不确定为什么这不起作用。 it was a few days ago. 是几天前 i know /getReviews is valid since i copied the same folder structure to another sever and it worked correctly http://javadash.com/yumninja_app_1_0/api/getReviews 我知道/ getReviews是有效的,因为我将相同的文件夹结构复制到另一个服务器,并且可以正常使用http://javadash.com/yumninja_app_1_0/api/getReviews

如果服务器是apache,请检查error.log文件,它应该提供有关问题所在的有用信息。

i figured it out. 我想到了。 It was because i had 那是因为我有

RewriteCond %{REQUEST_URI} !^/({app_name}|{app_name}.*)$

inside the .htaccess file in the api folder. 在api文件夹中的.htaccess文件中。 Once i removed it, it worked 一旦我删除它,它就可以了

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

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