【问题标题】:Removing index.php from url in codeigniter using .htaccess?使用.htaccess从codeigniter中的url中删除index.php?
【发布时间】:2015-09-30 04:15:07
【问题描述】:

http://localhost/codeigniter/index.php/user/main_page

如何从这个 url 中删除 index.php ?

【问题讨论】:

标签: .htaccess codeigniter


【解决方案1】:

试试这个文件。我在我的项目中使用它

https://github.com/eborio/curso-de-codeigniter/tree/master/02-primeros-pasos

【讨论】:

    【解决方案2】:

    答案在复制此问题的帖子中。

    This is the answer

    肖恩·维埃拉的回答:

    如果您使用的是 Apache,请在您的根网站中放置一个 .htaccess 文件 包含以下内容的目录:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    另一个不错的版本在这里:

    http://snipplr.com/view/5966/codeigniter-htaccess/

    【讨论】:

      【解决方案3】:

      试试这个:

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

      替换:

      $config['index_page'] = "index.php"
      to
      $config['index_page'] = ""
      
       if it still not work try to replace:
      
       $config['uri_protocol'] = "AUTO"
      //replace with the below code
      $config['uri_protocol'] = "REQUEST_URI"
      

      更多详情:http://w3code.in/2015/09/how-to-remove-index-php-file-from-codeigniter-url/查看此

      【讨论】:

        猜你喜欢
        • 2018-09-17
        • 2017-05-20
        • 1970-01-01
        • 2021-10-02
        • 2015-01-20
        • 2023-03-07
        • 1970-01-01
        • 2011-05-20
        • 2017-03-15
        相关资源
        最近更新 更多