Redirect 如何在zPanel上将所有http请求重定向到https

Redirect 如何在zPanel上将所有http请求重定向到https,redirect,ssl,https,http-status-code-301,Redirect,Ssl,Https,Http Status Code 301,我已使用正SSL证书配置了一个域。我的专用服务器使用Apache和zPanel在CentOS 6上运行 我想将所有http页面重定向到https 我在.htaccess上尝试了很多不同的代码,但没有一个有效: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} RewriteEngine on RewriteCond %{SERVER_PORT} !^443

我已使用正SSL证书配置了一个域。我的专用服务器使用Apache和zPanel在CentOS 6上运行

我想将所有http页面重定向到https

我在.htaccess上尝试了很多不同的代码,但没有一个有效:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] 

它似乎忽略了my.htaccess

尝试检查您的Apache服务器是否启用了mod_rewrite。 如果您已经设置了zpanel,只需以管理员身份登录并进入“admin>phpinfo>view full php configuration”。在新打开的页面上,向下滚动至“apache2handler”并检查您的模块

确保.htaccess位于web根目录中,例如“public_html”和chmoded到644