HTTPS正在运行且HTTP正在运行,但是当我尝试在.htaccess文件中将HTTP的重定向添加到HTTPS时,它会被重定向循环捕获。
这是apache:
ADODB
这是.htaccess文件:
Dim ret As Variant
ret = rs.GetRows '~~> assuming rs object is populated and set
Debug.Print Lbound(ret, 1), Ubound(ret, 1) '~~> bounds of 1st dimension
Debug.Print Lbound(ret, 2), Ubound(ret, 2) '~~> bounds of 2nd dimension
当我取消注释RewriteCond时,它会陷入循环中。在Wordpress中,我已将网站和主页面设置为https。
我还在wp-config.php中添加了以下内容,解决了https之前无法正常工作的问题:
<VirtualHost *:80>
DocumentRoot /var/www/html/mysite
ServerName mysite.com
ServerAlias www.mysite.com
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/html/mysite
ServerName mysite.com
ServerAlias www.mysite.com
SSLEngine On
SSLCertificateFile /var/SSLs/somecert.crt
SSLCertificateKeyFile /var/SSLs/somekey.key
SSLCACertificateFile /var/SSLs/trust.crt
</VirtualHost>
感谢任何帮助。请注意,我用mysite
替换了实际的域名答案 0 :(得分:1)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# I added these two lines for redirect to HTTPS
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R=301,L]
# (end of custom modifications)
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
你应该查看这些帮助链接:
Correctly switching between HTTP and HTTPS using .htaccess
Redirect Loop while redirecting all http requests to https using .htaccess