Total Pageviews

Monday 2 January 2012

Apache下,设置自动将http跳转到https方法

现在需要将原先的http直接跳转到https上,下面是方法,利用伪静态功能。
首先在网站根目录下创建.htaccess文件,如果目录下已经有.htaccess文件,则用编辑器打开,在最下面添加如下语句即可
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

No comments:

Post a Comment