Msg#: 4373210 posted 12:55 pm on Oct 11, 2011 (gmt 0)
I'm struggling with redirection. We own two domains: uglydomain.com and prettydomain.com. For the longest time our site was only available at uglydomain.com. Recently we purchased prettydomain.com and would like to migrate traffic over to the new domain. Setting it up so folks who browse to prettydomain.com get our content was easy. Where I'm having trouble is with the old url. I'd like anyone who still attempts to access our site at uglydomain.com to be automatically pushed to prettydomain.com. I attempted to do this via 301 in a .htaccess file but I think I'm doing something wrong. Here's what I did:
When I browse to www.uglydomain.com I thought it would push me onto www.prettydomain.com (changing the url in my browser) but no such luck. Do I have the 301 right? What should happen? Thanks in advance for your assistance!
Msg#: 4373210 posted 12:54 am on Oct 13, 2011 (gmt 0)
the '?' after the ')' makes the capture group optional, so hidden in g1smd's regexp is that it also matches when HTTP_HOST is exactly null. this is a good thing as it handles the special case of HTTP/1.0 user agent requests.