首页 文章

Codeigniter - mod_rewrite在 生产环境 服务器中不起作用

提问于
浏览
0

在 生产环境 服务器上设置mode_rewrite时出现以下错误:

尝试使用ErrorDocument处理请求时遇到404 Not Found错误 .

我在应用程序文件夹外面有index.php,因此我将路径设置为$ application_folder&$ system_path .

我的文件夹结构:

folder_A:
    folder_A1:
      index.php
      js
      css
    folder_A2:
      application
      system

这是文件夹_A1中的htaccess

RewriteEngine on
RewriteCond%
! - f
RewriteCond%
!-d
RewriteRule ^( . *)$ index.php / $ 1 [L]

我给了$ config ['index_page'] ='';

我已经尝试将RewriteBase改为'/'以及'path / to / app'但是徒劳无功 .

你能找到解决方案吗?

2 回答

  • 0

    你有权在.htaccess文件中配置重写规则吗?对于我的CI应用程序,我在.htaccess中有完全相同的规则,并且它正在运行 . 你的apache配置文件中有 AllowOverride ALL 这样的行吗?

  • 0

    据我所知,你的CI文件夹结构应该像这样使用mod_rewrite:

    root/.htaccess
    root/index.php
    root/assets/js
    root/assets/css
    root/assets/img
    
    root/application
    root/system
    

相关问题