-4

I bought my domain (let's say example.com) from namecheap and added a subdomain to my blog hosted at heroku. The associated host record looks like this:

Type: CNAME
Host: blog
Target: tomyblog.herokuapp.com

Now when I go to blog.example.com it acts like a redirect, it changes the address to the location bar to tomyblog.herokuapp.com. I want it to retain blog.example.com in the location bar since it's the address the user is supposed to see, not from where I'm serving the content.

I have read a few documentations where some suggested to use NS records, but that's not available to namcheap, so I can't really test. It only offers A, AAA, SRV and CNAME types of records.

Sayem
  • 93
  • 1

1 Answers1

4

The premise behind this question is incorrect. The CNAME does not act as a redirect. A redirect at the web server acts as a redirect.

Update: Your web server is sending this:

HTTP/1.1 301 Moved Permanently
Server: Cowboy
Connection: close
X-Powered-By: Express
Location: https://blog-onushshar.herokuapp.com/
Vary: Accept, Accept-Encoding
Content-Type: text/plain; charset=utf-8
Content-Length: 71
Date: Wed, 30 Sep 2015 14:50:32 GMT
Via: 1.1 vegur

Moved Permanently. Redirecting to https://blog-onushshar.herokuapp.com/

You need to investigate its configuration.

David Schwartz
  • 31,449
  • 2
  • 55
  • 84