Apache mod_rewrite: rewriting URLs based on HTTPS vs. HTTP
Wednesday, October 29th, 2008On occasion it’s helpful to be able to pass both SSL and non-SSL requests through the same Apache configuration file. Using mod_write’s RewriteCond and RewriteRule, you can perform URL rewriting differently depending on whether or not the connection is via HTTPS:
# For SSL connections %{HTTPS} is “on” — the following will
# permanently redirect all non-SSL [...]