Setting up DNS assistance

0

I want to make example.com and www.example.com point to blog.example.com. I cannot test this because DNS updates on live websites are so slow and I am not sure what record is not applying as it should.

My current setup is:

example.com site has two subdomains: www and blog.

example.com has the following records:

  1. example.com SOA 'some default value from my provider' (not quite sure what SOA record is)
  2. blog.example.com NS dns1.myprovider.com
  3. blog.example.com NS dns2.myprovider.com
  4. example.com NS dns1.myprovider.com
  5. example.com NS dns2.myprovider.com
  6. www.example.com NS dns1.myprovider.com
  7. www.example.com NS dns2.myprovider.com
  8. example.com TXT 'some default values from my provider' (not quite sure what TXT record is)

'www' subdomain has the following records:

  1. SOA record(default value)
  2. NS record(dns1) (not removable)
  3. NS record(dns2) (not removable)

'blog' subodmain has following records:

  1. SOA record(default value)
  2. NS record(dns1) (not removable)
  3. NS record(dns2) (not removable)
  4. A record(actual IP of server)

Beside this, I have defined two redirects:

example.com to blog.example.com

www.example.com to blog.example.com

Now when I go to blog.example.com it works as it should. When I go to example.com I am redirected to www.example.com and www.example.com returns "server DNS address could not be found."

What did I do wrong?

EDIT: Update after suggestions from Twisty. Current setup is: https://pasteboard.co/bRfMKJv09.png

And now I don't have redirection from www.example.com to blog.example.com

maleta

Posted 2017-05-24T22:14:24.040

Reputation: 101

What kind of redirects are we talking about here? CNAME records or something else? – Spiff – 2017-05-24T23:47:37.803

By the way, hostnames like www.example.com and blog.example.com are usually handled with simple A records, not as full subdomains. Subdomains are for when you want to create another whole layer of names. – Spiff – 2017-05-24T23:51:10.837

I dont know what kind of redirects I defined. I just have "Manage redirects" on my provider's domain control panel. I can remove those redirects if I manage to setup redirecton with records. How can I handle that redirects with A record? Is'n't A record used for allocating IP of server? – maleta – 2017-05-25T07:33:38.613

You can also look at using Hurricane Electric - https://dns.he.net to manage your DNS; They provide a free DNS service which is usually vastly more configurable than most ISP's. SOA record is "Start Of Authority" - The SOA record stores information about the name of the server that supplied the data for the DNS zone A TXT record is often used for SPF mail records - Sender protection Framework

– Darío Martín – 2017-05-25T09:19:16.610

But looking at your question, I'd say that the reason 'blog.example.com' works is that as @Spiff has mentioned, it has an A record, which tells the querying DNS server where to point. 'www.example.com' has no 'A' record so any querying DNS server will not know what IP address to return. – Darío Martín – 2017-05-25T09:26:53.523

@Dario Thank you for explanation. As for configuration: I am expecting that my DNS redirects www.example.com to blog.example.com before it looks for IP. – maleta – 2017-05-25T10:24:23.563

Answers

0

Resolution to my problem was to create subdomain 'www'. After adding 'www' subdomain, my page is being redirected to 'blog.example.com' with rules 'manage redirections' that was available from my ISP's DNS control panel.

maleta

Posted 2017-05-24T22:14:24.040

Reputation: 101

I'm glad you found a solution. However, something doesn't add up here. You stated in your original post that you already had a www subdomain, but it wasn't working. Did perhaps some of the changes made in my answer provide part of the solution? – I say Reinstate Monica – 2017-05-29T00:30:25.607

I had 2 redirection rules at beginning and 2 subdomains, but redirection didn't work. Your answer is part of solution because I needed A record for example.com directing to blog server address. – maleta – 2017-05-29T10:37:25.607

One more thing was also important so that my dns redirects work. For 'www.example.com' A record should point to default IP that my ISP set, not to actual server where my website is. – maleta – 2017-05-30T11:16:10.503

1

Here's how to accomplish this with DNS records:

  1. Remove the www and blog subdomains. They're superfluous for what you're trying to accomplish.

Then, in the example.com domain:

  1. Create an A record with the following values:
    Host: @ (None)
    Points to: Actual IP of server

  2. Create an A record with the following values:
    Host: blog
    Points to: Actual IP of server

  3. Create a CNAME record with the following values:
    Host: www
    Points to: blog.example.com

Now here's what happens when a visitor navigates to the various hostnames:

  • For blog.example.com the A record points them to the server
  • For www.example.com the CNAME record points them to blog.example.com
  • For example.com the A record points them to the server

Your server-side redirect from example.com to blog.example.com is still necessary. However the redirect for www.example.com to blog.example.com should no longer be required (you can leave both in place to be safe though).

For the root domain (example.com) you might be tempted to use a CNAME record to point to blog.example.com, however CNAME'ing a root record is generally discouraged for reasons explained here.

I say Reinstate Monica

Posted 2017-05-24T22:14:24.040

Reputation: 21 477

This is partially working. I removed both subodmains, Added 'blog.example.com A IP' record, added 'www.example.com CNAME blog.example.com', added 'example.com A IP'. I cannot type @ as Host value, also I cannot add 'example.com CNAME blog.example.com', but I added ISP's 'redirections' and now my example.com is not being redirected also I am not sure why I need A record for example.com if I have redirect defined for that url. – maleta – 2017-05-25T22:12:26.023

1>

  • Depending on your DNS provider's interface, you may just need to leave the host for the example.com A record blank to create the @. 2) As I said in my answer, you should not create a CNAME for the root example.com domain. The A record for the @ host will take care of lookups targeting the naked domain name. 3) The reason your example.com is not being "redirected" is because you don't have the A record for the @ host name. 4) The reason you need the A record for the root domain is because DNS lookups happen before redirects configured on your server. If there is no DNS record...
  • < – I say Reinstate Monica – 2017-05-25T22:31:43.857

    ...to capture traffic to example.com, the server redirect never gets a chance to work. – I say Reinstate Monica – 2017-05-25T22:37:06.667

    I did what you said. Take a look: https://pasteboard.co/bRfMKJv09.png But I am still not having redirect from www. to blog.

    – maleta – 2017-05-28T21:26:30.500

    When you ping www.example.com does it return the IP address of the server? – I say Reinstate Monica – 2017-05-28T21:30:14.810

    Yes. Ping returns valid IP. – maleta – 2017-05-28T21:31:55.973

    Then the problem is that your blog's server is seeing the header in the HTTP request for "www.example.com" and is not recognizing this as being intended for blog.example.com. That needs to be fixed on the server. Everything is correct in DNS. – I say Reinstate Monica – 2017-05-28T21:33:08.383

    Blog is Wordpress site with setting that default website url is blog.example.com. Anyhow, When I started with configuring DNS I had this redirection, but some other stuff didn't work and after I reset to default settings, I wasn't able to get that redirect back. P.S. Any link on www.example.com is pointing to blog.exampe.com. Do you have any resource for that needed server fix you are mentioning? – maleta – 2017-05-28T21:37:32.017

    Sorry, I don't know how to do that on WordPress. You can ask on SE.Web Apps – I say Reinstate Monica – 2017-05-28T21:43:39.090