Welcome to WebmasterWorld Guest from 107.22.87.205

Forum Moderators: phranque

Message Too Old, No Replies

Force HTTP to HTTPS

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

5+ Year Member



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)

WebmasterWorld Senior Member 5+ Year Member



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)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month