[nycbug-talk] OT: Apache/mod_rewrite question

Kevin Reiter tux at penguinnetwerx.net
Sun Jan 28 23:04:49 EST 2007

Jonathan Stewart wrote:
> Kevin Reiter 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.  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.
> Not exactly what your asking about but have you considered using a 
> dynamic DNS service?  I use No-IP () and have been very happy with them. 
>  They even manually setup IPv6 records for me even though they are not 
> technically supported.  Although I am paying for a domain name and dns 
> they provide free sub-domains as well.  If thats not an option I'll see 
> what I can do about a rewrite rule for you.
> Jonathan

This is for a traveling laptop that I use both at home and at client 
sites, and as a test machine at my new job, so I don't always have the 
same IP, which is how I typically access the server.

I should've mentioned that I know about zero when it comes to writing 
rewrite rules (this would be a first).

In this case, a dynamic DNS service would do nothing for me (I've had a 
paid account with FreeDNS[1] for years now.)

Basically, I'm looking to force the use of SSL on my webserver 
(apache+mod_ssl-1.3.37+2.8.28) when the IP and domain are always changing.

I recall seeing something about {SERVER_ADDR} as a variable, which would 
be exactly what I'm looking for, but I don't have a clue outside of that 
what to write in the .htaccess file.

More information about the talk mailing list