网站在移动设备上使用ssl时不显示,但在台式机上显示

时间:2020-07-24 16:46:51

标签: apache .htaccess

我已经编程了一个网站,该网站是www.shoesbank.org 我使用以下代码重定向到https。它在桌面上完美运行。但是当我想在手机上使用它时。我收到错误消息,提示“无法访问该站点”。当我删除https重定向时,它会完美显示。我花了几个小时来搜索它,但是我什么也没发现。我感谢您的帮助。 httaccess:

RewriteEngine On
RewriteEngine on
RewriteCond %{HTTP_HOST} ^shoesbank.org [NC]
RewriteRule ^(.*)$ https://www.shoesbank.org/$1 [L,R=301,NC]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(support\.)?abc\.com$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

1 个答案:

答案 0 :(得分:0)

配置apache服务器时,我更喜欢在apache配置中处理https,而不是在.htacces中处理。

<VirtualHost *:80>
   ServerName shoesbank.org
   ServerAlias www.shoesbank.org
   Redirect / https://shoesbank.org
</VirtualHost>
<VirtualHost *:443>
   ServerAdmin contact@shoesbank.org
   DocumentRoot /var/www/shoesbank.org/public_html/
   ServerName shoesbank.org
   ServerAlias www.shoesbank.org

   SSLEngine on
   SSLCertificateFile /etc/ssl/shoesbank.org.crt
   SSLCertificateKeyFile /etc/ssl/shoesbank.org.key
   SSLCertificateChainFile /etc/ssl/shoesbank.org.ca-bundle
  <Directory /var/www/shoesbank.org/public_html/>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>

希望它能起作用。