【问题标题】:Htaccess doesn't allow requesting resources in sub folder applicationHtaccess 不允许在子文件夹应用程序中请求资源
【发布时间】:2016-03-18 13:24:22
【问题描述】:

我的 .htaccess 文件的配置有问题。应用程序是用 AngularJs 编写的,而 restApi 应用程序是用 Codeigniter 编写的,它位于 /server 文件夹中。

这是我的文件夹结构 我的 api 文件夹结构

这是我正在处理的 .htaccess 文件

RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

问题是,当我尝试访问我的 api 资源时,我不断得到 404 页面,而这在我的 debian nginx 服务器上完美运行,这就是为什么我猜测这是 .htaccess 文件中的问题

http://myApp.com/server/api/products/latest/1

我希望你们能帮助我。如果您需要任何其他信息,请告诉我,我会提供。提前谢谢你。

【问题讨论】:

  • 我可以看看服务器控制器的样子吗?
  • 您想查看文件夹结构还是某些特定的服务器控制器?否则,这在 centos 7 + nginx、debian + nginx 上运行良好。当我尝试将它添加到我的 localhost wamp 设置时,它只是有问题。
  • 不,你的 URL 表示 myApp.com/server/api/products/latest/1,如果这是 CodeIgniter,我的假设是,服务器是控制器 (myApp.com/server)
  • 不完全正确。该应用程序具有与我的相同的文件夹结构及其工作。这里的问题出在 htaccess 文件中。 github.com/colinjlacy/clocks
  • 在 .htaccess RewriteBase /server/ 中尝试。还要确保在配置 $config['index_page'] = ' ';

标签: angularjs .htaccess codeigniter wamp


【解决方案1】:

在 .htaccess 中尝试

RewriteBase /server/

还要确保在 config.php 中

$config['index_page'] = ' '; 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-27
    • 2014-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多