Next Image
Make the current image sticky.
Previous Image
randys.org - randys.org

Apache2: mod_rewrite vs. mod_proxy

I can’t quite figure this out. I’m trying to write a simple rule to force randys.org to redirect to www.randys.org but it’s not realy working. Of course, I haven’t tried it on a vhost that isn’t proxying request to mongrel. Here’s the rule:

RewriteEngine On
RewriteCond %{HTTP_HOST}    !^www.randys.org$ [NC]
RewriteCond %{HTTP_HOST}    !^$
RewriteRule ^/(.*)          http://www.randys.org/$1 [R=301,L]

Anyone?

2 Responses to “Apache2: mod_rewrite vs. mod_proxy”

  1. John Gruber did a write-up about this topic last year. You might find the information helpful.

    I haven’t tested it, but I think this is what you want:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^randys\.org$
    RewriteRule (.*) http://www.randys.org/$1 [R=Permanent]
    

    Nice redesign, by the way…

  2. Hmmm, for some reason, this isn’t working. I’ve added this to the main apache2 config as well as the config for the site and the .htaccess file. I seems like it just ignore it. I’m wondering if it has something to do with mod_proxy?

    Thanks… some random template. ;)

• • •

All content Copyright © 1999 — 2010 Randy Sesser | Happily Hosted by WebFaction
Entries (RSS) | Comments (RSS)