我们需要找到Apache的配置文件httpd.conf,然后添加以下代码:
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
以上代码是针对整站进行跳转,如果只需要跳转某个目录,则添加一下代码:
RewriteEngine on
RewriteBase /yourfolder
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)