codeigniter,htaccess force https除了一个url

时间:2017-05-31 04:48:44

标签: php apache .htaccess codeigniter mod-rewrite

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

网址测试1:

http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back

应保持为

http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back

网址测试2:

http://hub-dev-1.andatech.com.au/controller/method

我使用此工具测试htaccess:http://htaccess.mwl.be/

这是我的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 "*"

http://htaccess.mwl.be上进行测试,工作。

在浏览器上测试, http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back重定向到 https://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back

apache conf:

<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>

ssl apache conf

<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>

0 个答案:

没有答案