I'm trying to redirect my bare domain (http://leun.ga/) to a subdomain (http://nathan.leun.ga/), using DNS records only. (Since it's Github Pages, I can't do any .htaccess magic)

At the moment, I've got http://leun.ga redirecting to http://www.leun.ga using WWWizer. However, I can't figure out how to redirect http://www.leun.ga/ subdomain to http://nathan.leun.ga.

Here are my current DNS records:

   Host  |  Type  |        Record
  @      | A      |           // WWWizer record to redirect to WWW
  nathan | CNAME  | nathanhleung.github.io
  www    | CNAME  | nathanhleung.github.io

I thought that making the WWW CNAME http://nathanhleung.github.io would work but I'm getting the Github Pages 404 error. How can I redirect the WWW to the NATHAN subdomain using only DNS?

  • when a computer asks for www.leun.ga, DNS tells it to try the name nathanhleung.github.io which it then looks up the IP address for. But when the computer contacts that IP address and says "please show me www.leun.ga", GitHub rightfully says "I have no idea what that site is" because it only serves up github.io pages. You need a web server based redirect to tell the browser to convert www.leun.ga to nathanhleung.github.io and then contact nathanhleung.github.io using the web site name nathanhleung.github.io. You need an apache RewriteRule on a web server on www.leun.ga somewhere.
    – simpleuser
    Commented Apr 19, 2016 at 3:50

1 Answer 1


You can't. DNS only tells your browser which IP address to connect to. You get the 404 page because your browser is asking the web server at that IP address for a URL the server does not know about (that is, http://nathan.leung.ga/). DNS cannot make your browser ask for a different URL, nor inform the web server of new sites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.