CNAMES and A Records and MX, Oh My!

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi again!  Long-time lurker
and occasional poster Guy Macon, checking in...

I just had an interesting DNS interaction I would like to share.

I was optimizing so that search engines see
my one prefered URL ([ ]) even if
the link is to a variation such as [ ]
[ ] or even
[ ].

(I use for experimenting prior to applying the
changes to my main website.  Right now there is
a test page there -- watch the address bar as you click on the
various links.)

I did all of this with .htaccess using this mod_rewrite code:  

 RewriteEngine On

 Options +FollowSymLinks -MultiViews
 DirectoryIndex index.html
 AddDefaultCharset US-ASCII
 AddType image/x-icon .ico
 AddType 'text/html; charset=US-ASCII' html
 AddType 'text/plain; charset=US-ASCII' txt

 RewriteCond % ^[A-Z]\ /([^/]+/)*index\.html\ HTTP/
 RewriteRule ^(([^/]+/)*)index\.html$ /$1 [R=301,L]

 RewriteCond % !^www\.guymacon\.org$ [NC]
 RewriteRule ^(.*)$ /$1 [R=301,L]

This worked fine, but then I decided to get clever...

I set my DNS for like this: CNAME: MX: 33 TXT: v=spf1 -all A Record:

...and was like this: CNAME: TXT: v=spf1 -all CNAME:

My thinking was that the CNAMES would give search engines an
additional indication that is the domain that
I want indexed.

Here is where the interaction kicked in.  Sending a test
email to gave me this error:

   ----- The following addresses had permanent fatal errors -----

   ----- Transcript of session follows -----
 ... while talking to
 >>> DATA

 554 5.0.0 Service unavailable
 <<< 554 Error: no valid recipients

And of course I realized that it was doing just what I told it
to do; redirecting all calls to to,
...including emails!  

The solution was to stop being so clever and making
the DNS records look like this:

for A Record: MX: 33 TXT: v=spf1 -all A Record:

for A Record: MX: 33 TXT: v=spf1 -all A Record:

...thus sending all requests to the IP address and letting
the .htaccess that is there do the 301 redirects.  
Now the webpage and email requests all do what I want.

Guy Macon

Re: CNAMES and A Records and MX, Oh My!

On Wed, 14 May 2008 03:22:06 +0000, Guy Macon
< wrote:

Quoted text here. Click to load it

Trees green, sky blue. The others might have a more informed opinion
but that's the best you'll get out of me :-)

Nice to hear from you, Guy.

-- /

Site Timeline