【问题标题】:try to remove index.php in codeigniter [duplicate]尝试删除 codeigniter 中的 index.php [重复]
【发布时间】:2013-01-16 09:39:58
【问题描述】:

可能重复:
How to remove “index.php” in codeigniter’s path

1.在codeigniter目录下创建一个.htaccess文件,代码如下

 <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase /ex/
     RewriteCond $1 ^(application|system|private|logs)
     RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]
     RewriteCond $1 ^(index\.php|robots\.txt|opensearch\.xml|favicon\.ico|assets|forums)
     RewriteRule ^(.*)$ - [PT,L]
     RewriteRule ^(.*)$ index.php/$1 [PT,L]
  </IfModule>

2.将config['index_page']='index.php'改为config['index_page']=''

但它不起作用。我的 httpd.conf(/etc/apache2/) 是空白的

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    在你的 .htaccess 文件中试试这个

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

    【讨论】:

      【解决方案2】:

      确保您已在 Apache 模块上启用 rewrite_module

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

      【讨论】:

        【解决方案3】:
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule .* index.php/$0 [PT,L]
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-08-12
          • 2013-08-02
          • 2013-05-09
          • 1970-01-01
          • 2011-07-09
          • 1970-01-01
          • 2012-10-30
          • 2013-04-13
          相关资源
          最近更新 更多