Create hyperlinks to switch between HTTP and HTTPS

SSL, TLS related

Create hyperlinks to switch between HTTP and HTTPS

Postby produke » 24 Oct 2006 23:10

Usually you have to use fully-qualified hyperlinks because you have to change the URL scheme. But with the help of some URL manipulations through mod_rewrite you can achieve the same effect while you still can use relative URLs:

Code: Select all
RewriteEngine on
RewriteRule   ^/(.*):SSL$   https://%{SERVER_NAME}/$1 [R,L]
RewriteRule   ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1  [R,L]
   


This rewrite ruleset lets you use hyperlinks of the form

<a href="document.html:SSL">
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Return to SSL



Who is online

Users browsing this forum: No registered users