Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php codeigniter,htaccess强制https,一个url除外_Php_Apache_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

Php codeigniter,htaccess强制https,一个url除外

Php codeigniter,htaccess强制https,一个url除外,php,apache,.htaccess,codeigniter,mod-rewrite,Php,Apache,.htaccess,Codeigniter,Mod Rewrite,我尝试将所有url强制为https,除了一个url。到目前为止没有成功。有人知道我的htaccess或Codeigner有什么问题吗 Url测试1: 应该保持原样 Url测试2: 我使用此工具测试htaccess: 这是我的访问权限 RewriteOptions inherit RewriteEngine on RewriteCond %{HTTPS} !=on RewriteCond %{REQUEST_URI} !^/utility/mandrills/email_bounced_b

我尝试将所有url强制为https,除了一个url。到目前为止没有成功。有人知道我的htaccess或Codeigner有什么问题吗

Url测试1:

应该保持原样

Url测试2:

我使用此工具测试htaccess:

这是我的访问权限

RewriteOptions inherit
RewriteEngine on

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/utility/mandrills/email_bounced_back
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_URI} !^/(assets|test)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php/$1 [PT,L]

Header set Access-Control-Allow-Origin "*"
测试,工作

在浏览器上测试, 重定向到

apache配置文件:

<VirtualHost *:80>
  ServerAdmin test@test.com
  ServerName hub-dev-1.andatech.com.au
  ServerAlias www.hub-dev-1.andatech.com.au
  DocumentRoot /home/thehub/public_html
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

  <Directory /home/thehub/public_html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    # Hak apache 2.2
    # Order deny,allow
    Allow from all
    # Hak apache 2.4
    Require all granted
  </Directory>

</VirtualHost>

服务器管理员test@test.com
ServerName hub-dev-1.andatech.com.au
ServerAlias www.hub-dev-1.andatech.com.au
DocumentRoot/home/thehub/public\u html
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
选项索引跟随符号链接多视图
允许超越所有
#hakapache2.2
#命令拒绝,允许
通融
#hakapache2.4
要求所有授权
ssl apache配置

<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerAdmin test@test.com
  ServerName hub-dev-1.andatech.com.au
  ServerAlias www.hub-dev-1.andatech.com.au
  DocumentRoot /home/thehub/public_html
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

  <Directory /home/thehub/public_html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    # Hak apache 2.2
    # Order deny,allow
    Allow from all
    # Hak apache 2.4
    Require all granted
  </Directory>

  SSLCertificateFile /etc/letsencrypt/live/hub-dev-1.andatech.com.au/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/hub-dev-1.andatech.com.au/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

服务器管理员test@test.com
ServerName hub-dev-1.andatech.com.au
ServerAlias www.hub-dev-1.andatech.com.au
DocumentRoot/home/thehub/public\u html
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
选项索引跟随符号链接多视图
允许超越所有
#hakapache2.2
#命令拒绝,允许
通融
#hakapache2.4
要求所有授权
SSLCertificateFile/etc/letsencrypt/live/hub-dev-1.andatech.com.au/fullchain.pem
SSLCertificateKeyFile/etc/letsencrypt/live/hub-dev-1.andatech.com.au/privkey.pem
Include/etc/letsencrypt/options-ssl-apache.conf

它在下一轮中确实获得了
index.php
。也许
RewriteRule^/?index\.php-[L]
作为一个顶级规则可以解决这个问题。确切地说,第二个规则是prepending index.php,然后它(内部)返回到重写管道的顶部,在第二个过程中它不会被
RewriteCond%{REQUEST\u URI}捕获^/实用程序/mandrill/email\u反弹回来
(因为索引,php),因此被重写为https。例如,您可以从
RewriteCond%{REQUEST\u URI}中删除
^
^/实用程序/山楂树/电子邮件\u反弹\u回来
对不起,第二关是什么?我认为第一条重写规则失败,然后能够满足第二条重写规则。这是index.php。最后一个重写规则有[PT,L],因此这是最终规则。没有……?没有: