我有一个网站,主页上有一个论坛(使用 Xenforo 创建)。我最近将 HTTPS 与Let's encrypt一起使用(我已使用 cPanel 在服务器端启用它)。该网站在 HTTP 上运行良好。
现在我有了 HTTPS,我遇到了问题,因为有些人可以像往常一样访问该网站,但其他人不能。那些无法打开我的网站的人必须使用代理,然后网站才会加载。
在我编辑.htaccess
文件中的一行后,此错误开始发生:
# Mod_security can interfere with uploading of content such as attachments. If you
# cannot attach files, remove the "#" from the lines below.
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default
<IfModule mod_rewrite.c>
RewriteEngine On
# I HAVE ADDED THESE 2 NEW LINES
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://forums.example.com/$1 [R,L]
# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo
# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
</IfModule>
我添加了这两行:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://forums.example.com/$1 [R,L]
现在我有一个奇怪的问题:有些人可以访问我的网站,有些人不能,他们必须使用代理!
我添加了这些规则,因为我需要将所有 http 重定向到 https 所以http://forums.example.com/
必须成为https://forums.example.com/
. 我以前从未遇到过这个问题。任何想法?