简体   繁体   中英

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

in the root, the htaccess file is

<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

if you go to 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

Here is the htaccess file inside the api folder

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

如果服务器是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. Once i removed it, it worked

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