【问题标题】:when using https, https can't find codeigniter controllers. Running Centos使用 https 时,https 找不到 codeigniter 控制器。运行 Centos
【发布时间】:2013-06-27 07:33:47
【问题描述】:

所以我设置了 https 以在我的网站上工作。主页工作。 https://mysite.com 但是当您尝试转到 https://mysite.com/join 之类的子文件夹时,您会收到以下错误。

找不到

在此服务器上找不到请求的 URL /join/index.php。

Apache/2.2.8 (CentOS) 服务器位于 mysite.com 端口 443

好像看不懂codeigniter。下面是我的 htaccess 文件。

RedirectMatch 404 /\\.git(/.*|$)

RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteCond $1 !^(index\.php|images|img|js|css)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L] 
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https: //%{SERVER_NAME}%{REQUEST_URI} [R=301] 
ErrorDocument 404 /system/error/404page.html

我与其他几个开发人员仔细检查了 ssl 虚拟主机,它设置正确。奇怪的是主页可以正常工作,而没有别的。我猜这是因为主页上有 codeigniter index.php 可供查看。

我将基本 URL 设置为 https://mysite.com

codeIgniter 中是否有一些我遗漏的设置?

【问题讨论】:

    标签: php codeigniter ssl https centos


    【解决方案1】:

    我终于明白了。

    在 httpd.conf 中我不得不改变这个:

    <Directory />
    Options FollowSymLinks
    AllowOverride None
    
    </Directory>
    

    到这里:

    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>
    

    我知道这是一件如此小而烦人的事情。谢谢大家的帮助!

    【讨论】:

      【解决方案2】:

      改变这一行:

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

      到:

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

      否则 .htaccess 将被重定向到加入文件夹中的 index.php,而这当然不存在。

      【讨论】:

      • 我进行了更改并重新启动了服务器,但它仍然给我同样的错误。下面是我的 htaccess RedirectMatch 404 /\\.git(/.*|$) RewriteEngine On Options +FollowSymLinks RewriteBase / RewriteCond $1 !^(index\.php|images|img|js|css) RewriteCond %{ REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{HTTPS} 关闭 RewriteRule ^(.*)$ https://%{SERVER_NAME }%{REQUEST_URI} [R=301] ErrorDocument 404 /system/error/404page.html
      • 如果我添加 index.php/join 然后子域工作。所以我很确定我只是在 htaccess 上做错了。
      猜你喜欢
      • 2015-01-25
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-18
      • 1970-01-01
      相关资源
      最近更新 更多