【问题标题】:Codeigniter Index.php in HTTPS URLHTTPS URL 中的 Codeigniter Index.php
【发布时间】:2013-11-03 06:42:18
【问题描述】:

我遇到了 CodeIgniter 和 htaccess 的问题。

当我通过 http 或 localhost 访问我的网站时,我可以访问 mysite.ext/controller/view ,例如 admin/login

但是当我之前使用 HTTPS 访问我的网站时,它会发送 404 错误,所以我必须编写 mysite.ext/index.php/controller/vie w,它的工作原理。

问题是我不想要 index.php,当我尝试在互联网上找到的解决方案时,它有时会删除 index.php,但我只能访问 /index/控制器,而不是管理员和其他人。

我在这里尝试了这个解决方案: codeigniter + not index.php with https

它删除了作为引导程序的 index.php,controller/view index/firstpage 可以工作,但其他控制器不能工作。

PS:HTTPS URL 与 HTTP URL 不同。 HTTP URL 进入服务器,但 HTTPS 由我的主机提供(所以,https://ovh....blabla../mywebsite/)

我想了解它为什么不起作用并找到解决方法。

【问题讨论】:

    标签: .htaccess codeigniter ssl https indexing


    【解决方案1】:

    https url 中的 codeIgniter 设置没有什么特别的配置。首先,您从配置文件中删除 $config['base_url] 并将 ''(blank) 放入 $config['index'] 属性中..

    您可以设置您的 .htaccess 文件,如..

    <IfModule mod_rewrite.c>
     RewriteEngine On
    
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
    
      # Rewrite all other URLs to index.php/URL
      RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
      </IfModule>
      <IfModule !mod_rewrite.c>
          ErrorDocument 404 index.php
      </IfModule>
    

    以上代码是从 url 中删除 index.php。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-17
      • 1970-01-01
      • 2014-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-26
      相关资源
      最近更新 更多