【问题标题】:Internal Server Error in Codeigniter htaccessCodeigniter htaccess 中的内部服务器错误
【发布时间】:2014-12-20 16:06:41
【问题描述】:

我是 codeigniter 的新手,我只想从一页切换到另一页。我正在使用 localhost 和 wamp 服务器

在配置文件中:

$config['index_page'] = 'index.php';

我改成

$config['index_page'] = '';

在 .htaccess 文件中:

Deny from all

我改成

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

并将此文件保存在应用程序、系统和根目录中。

提前谢谢,请帮助我,真的需要帮助。

【问题讨论】:

    标签: php apache .htaccess codeigniter localhost


    【解决方案1】:

    确保在 php.ini 文件中启用 mod_rewrite,然后在您的 htaccess 文件中使用以下内容。

    # Use PHP5CGI as default
    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /yourprojectfolder/
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    

    当您保存所有应用程序和系统文件夹时,将 yourprojectfolder 替换为您的项目文件夹的名称。

    【讨论】:

      【解决方案2】:

      你所做的一切都是对的,只需像这样更改根目录中的 .htaccess 代码即可。

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

      【讨论】:

        猜你喜欢
        • 2012-05-01
        • 2014-08-21
        • 2016-04-15
        • 2023-03-05
        • 1970-01-01
        • 2014-10-31
        • 2016-07-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多