Welcome to WebmasterWorld Guest from 107.22.55.73

Forum Moderators: phranque

Message Too Old, No Replies

Force HTTP to HTTPS

     
12:04 am on Nov 11, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 21, 2006
posts: 54
votes: 0


How do I force a Web page to display in HTTPS? I am not using Apache - I am using Microsoft IIS 5.0.
1:52 am on Nov 11, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 16, 2007
posts: 846
votes: 0


I don't know if you can have IIS include a piece of code like this snippet of Pythonscript. This is executed during every request.


request = context.REQUEST
if request.URL.find('manage.example.com') == -1: # skip all if management hostname
..if request.URL.find('example.com/shop') != -1: # skip rest if not browsing the shop
....if request.URL[0:5] != 'https':
......request.setServerURL('https', 'secure.example.com', '443')
......return request.RESPONSE.redirect(context.absolute_url(), status=301, lock=1)
..else: # not in shop
....if request.URL[0:5] != 'http:':
......request.setServerURL('http', 'www.example.com', '80')
......return request.RESPONSE.redirect(context.absolute_url(), status=301, lock=1)
2:42 am on Nov 11, 2008 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14791
votes: 86