【问题标题】:remove index.php of the url 1and1 with codeigniter使用 codeigniter 删除 url 1and1 的 index.php
【发布时间】:2014-03-15 20:31:01
【问题描述】:

您好,我在通过 htaccess 1and1 从 url 中删除 index.php 时遇到问题,我尝试了几个其他线程的示例,但也没有工作。 如果我在 localhost 上运行,htaccess 如下:

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

【问题讨论】:

    标签: php .htaccess codeigniter mod-rewrite


    【解决方案1】:

    希望对您有所帮助。

    1. 检查mod_rewrite是否开启。

    2. config.php

      中删除 index.php
      //$config['index_page'] = 'index.php'; //old line
      
      $config['index_page'] = ''; // New line
      
    3. .htaccess

      中添加以下代码
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php/$1 [L]  
      

    【讨论】:

    • 我也有。我需要检查 mod_rewrite。如何检查 mod_rewrite?
    • echo phpinfo();在加载的模块中检查“mod_rewrite”。
    【解决方案2】:

    最后一行尝试使用

    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-14
      • 2014-10-28
      • 2012-06-15
      • 2012-09-21
      相关资源
      最近更新 更多