Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1691651
  • 博文数量: 362
  • 博客积分: 10587
  • 博客等级: 上将
  • 技术积分: 4098
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-10 18:15
文章分类

全部博文(362)

文章存档

2014年(1)

2013年(58)

2011年(115)

2010年(112)

2009年(76)

分类: 系统运维

2011-06-30 16:01:20

今天早上朋友说他的客户中心启用了https的ssl证书,现在需要将原先的http直接跳转到https上,下面我给出我经常使用的方法,利用伪静态功能

    #

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    #

    # for more information.

    #

    Options FollowSymLinks


    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   Options FileInfo AuthConfig Limit

    #

    AllowOverride All #这里原先是None要改为All


    #

    # Controls who can get stuff from this server.

    #

    Order allow,deny

    Allow from all



首先在网站根目录下创建.htaccess文件,如果目录下已经有.htaccess文件,则用vi或者其他编辑器打开,在最下面添加写入如下语句即可

 

RewriteEngine on

RewriteBase / #我这行是没有配置

RewriteCond %{SERVER_PORT} !^443$

RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

 

阅读(22071) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~