• 0

mod_rewrite to external domain


Question

I usually point my sites that require email to Google Apps. I've added CNAME records to the DNS to point mail, docs, and calendar appropriately, but I also want to have a wildcard subdomain match so that all subdomains are sent to my VPS and handled there (this way I don't have to add a record for each subdomain that I may create). I'm using VirtualDocumentRoot so that I can map any subdomain to a domain instantly by adding a folder, without ever having to touch my apache config. I could create an .htaccess file to redirect accordingly, but I'd have to do this for every single domain that I have now and any I add in the future; it's a tedious solution to say the least.

What I want is to capture any mail, docs, or calendar subdomain and rewrite or redirect them to the proper Google App page. I can't seem to figure out how my rule needs to be written. My condition appears to be working, but I have a feeling even that could be wrong since I tested it against a simple expression and had nothing after my domain name:

RewriteCond %{HTTP_HOST} ^mail\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,L]

Any ideas? Thanks.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.