[nycbug-talk] OT: Apache/mod_rewrite question

Ivan "Rambius" Ivanov rambiusparkisanius at gmail.com
Mon Jan 29 00:29:54 EST 2007


Hello,

On 1/29/07, Kevin Reiter <tux at penguinnetwerx.net> wrote:
> All,
>
> I've been trying to figure this out for a few hours now, and I can't
> quite get it working, and I *know* someone in here knows how to do this...
>
> I'm trying to force all traffic to an Apache server (on my laptop) to
> use SSL.
I did the same, but only for certain

> The laptop is on a dynamic IP with no static domain, so I
> can't force http://machine.domain.tld to https://machine.domain.tld, and
> since the IP changes depending on where I am, I can't use that for a
> rewrite, either.
>
> Do any of you Apache gurus know of a way to do this using an .htaccess
> file or via a simple edit to httpd.conf?  I've been checking Google for
> awhile, but everything I've come across doesn't quite do the trick.

I use the following directives to always redirect http trafiic to a
given URL to https traffic:

RewriteEngine on
RewriteLog logs/rewrite_log
RewriteLogLevel 9
RewriteCond %{HTTPS} !=on
RewriteRule "^(/svn/.*)" "https://%{HTTP_HOST}$1" [R,L]

I believe if you tweak the regular expression in RewriteRule, you can
forward the evry URL to https.

Regards
Ivan

-- 
Tangra Mega Rock: http://www.radiotangra.com



More information about the talk mailing list