Search code examples
http-redirectdnssubdomain

Subdomain Redirection


I have one of those fancy domains that when you include the subdomain spell out a whole word.

For example: g.oog.le

I'm having a heck of a time getting the redirects to work properly.

I want http://www.oog.le and http://oog.le requests to redirect to http://g.oog.le

Can I accomplish this with DNS records? Or do I need to edit the Apache config for the site? Or .htaccess? I've tried cname, .htacess and nothing is working...

Any help is appreciated.

Thank you


Solution

  • You can definitely use CNAME records to point out to the servers you intended to reach. But, DNS operation happens under the hood, and browser is abstracted from a DNS lookup. So browser keeps the hostname you entered in HOST HTTP header field, which is potentially considered as invalid by orginal servers. HTTP redirects is a clever option.