• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

Redirect http to https

发布: 2007-7-04 12:06 | 作者: admin | 来源:  网友评论 | 查看: 82次 | 进入软件测试论坛讨论

领测软件测试网 Tuesday, June 14 2005 @ 03:39 PM CDT
Contributed by: semiotica
Views: 1567 javascript:window.open(this.src);" style="CURSOR: pointer" onload="return imgzoom(this,550)">A quick overview of doing redirects from non-ssl to ssl websites.

Ed. Note: While you should be able to do this in the 10.4 webGUI, you were unable do this in earlier versions of OS X Server. That'swhere this comes in handy, although this method should work for allversion of OS X, or Apache on any system for that matter.


OS X ServerHOW TO: redirect http requests to https

If you have set up a site using ssl all requests for that domain not preceded by https it will point to the defualt web site. If what is required is that all requests for the domain on port 80 go to the 443 or in other words all requests for http go to https, there are a number of ways of doing this (using htacces or other scripting), however the following is the method we prefer.

1 go to the site config file at /etc/httpd/sites/

cd /etc/httpd/sites/

open the config file (e.g. 0016_195.75.175.184_443_secure.example.com.conf) in pico and edit the section


RewriteEngine On
RewriteCond % ^TRACE
RewriteRule .* - [F]

adding the following condition and rule and either delete or comment out the existing conditions and rules.

RewriteCond % !443
RewriteRule (.*) https://secure.example.com/ [R]

so that it reads as


RewriteEngine On
## RewriteCond % ^TRACE
## RewriteRule .* - [F]
RewriteCond % !443
RewriteRule (.*) https://secure.example.com/ [R]

2. In server admin duplicate the site secure.example.com, turn the web service off, edit the new site changing (from general) the port from 433 to 80, and from secure turn Enable Secure Sockets Layer off. You will now have two site config files in /etc/httpd/sites/ (e.g 0016_195.75.175.184_443_secure.example.com.conf and 0016_195.75.175.184_80_secure.example.com.conf).

3 Restart the web service and all requests to http://secure.example.com will be automatically redirected to https://secure.example.com.

It may appear contradictory to have two sites with the same name but one is on port 80 and the other is on port 443, Apache does allow this configuration. This method allows you to treat all virtual sites on an individual basis, you may wish some to be accessed only via ssl and others to be accesses via ssl and non ssl.


Last updated 08/06/05 Bruce Robbins

Platform: Mac OS X Server 10.3 or laterFurther reading

http://httpd.apache.org/docs/mod/mod_rewrite.html

http://www.modssl.org/docs/2.8/ssl_howto.html

http://www.whoopis.com/howtos/apache-rewrite.html

http://joseph.randomnetworks.com/archives/2004/07/22/redirect-to-ssl-using-apaches-htaccess/

http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

http://www.entropy.ch/software/macosx/docs/mod_ssl.html


延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网