【问题标题】:Codeigniter without index.php changing in config and .htaccess not workingCodeigniter 没有 index.php 更改配置和 .htaccess 不工作
【发布时间】:2011-11-01 17:34:16
【问题描述】:

我的子域的 codeigniter 存在这个问题,我想在其中取出 index.php,但由于某种原因无法正常工作。

我已将 .htaccess 设置为:

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

还有 config.php index_page 设置已更改如下:

$config['index_page'] = '';

你知道为什么它不起作用吗?

【问题讨论】:

  • 您的Apache 中是否启用了mod_rewrite 模块?检查您的 httpd.conf 文件中是否有 LoadModule rewrite_module modules/mod_rewrite.so 未注释。

标签: php .htaccess codeigniter


【解决方案1】:

这是我的

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA] 

【讨论】:

    【解决方案2】:

    这是我目前的设置方式,希望对您有所帮助。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-29
      • 1970-01-01
      • 2020-04-04
      • 2016-02-14
      • 2012-01-17
      • 1970-01-01
      • 2013-10-21
      • 2012-08-15
      相关资源
      最近更新 更多