4

I know this question has been asked Domain doesn't work without www

But I need a solution for node.js app hosted on heroku and using namecheap with komodo

Also, I found this similar thing which i didnt' understand at all.

Can someone give an example of how to handle this in node.js?

Details: I'm using express. In Heroku I have

example.me(Domain Name)   yamanashi-3938.herokussl.com (DNS Target)

www.example.me(Domain Name)   yamanashi-3938.herokussl.com(DNS Target)

In Namecheap I have:

 @ | https://www.example.me | URL redirect 
www | yamanashi-3938.herokussl.com. | CNAME
MartianMartian
  • 1,753
  • 1
  • 18
  • 26
  • 1
    Several questions. Are you using Express in node.js? Do you have a DNS record set up for your domain with the `www` on it? If so, is that pointing to the same server. And, do you want the site to just work without `www` or do you want it to redirect to the `www` URL (the redirect is generally considered better for SEO, I believe). – jfriend00 Aug 10 '15 at 02:26
  • Not sure if what i did worked as you pointed out.. can you check again? I updated – MartianMartian Aug 10 '15 at 03:12
  • 3
    I voted to close this question because it is not a programming question and it is off-topic on Stack Overflow. Non-programming questions about your website should be asked on [webmasters.se]. In the future, please ask questions like this there. – Stephen Ostermiller Mar 21 '22 at 09:35
  • sure thing. why don't you guys come up with a 'question migration button' for those in the wrong bucket? seems some are quite focused on this issue – MartianMartian Mar 21 '22 at 14:38

1 Answers1

5

www.example.com and example.com are different records in the DNS. You need to make sure both are pointing to the same place. You can either set both to point to the same address or setup the example.com to redirect to the www.example.com.

If you're using namecheap it should look something like this.

+------------+---------------------------+--------------+
| Host Name  |      IP Address/URL       | Record Type  |
+------------+---------------------------+--------------+
| @          | http://www.yourdomain.com | URL Redirect |
| www        | app-name.herokuapp.com.   | CNAME(Alias) |
+------------+---------------------------+--------------+

Make sure you also add the domain under your Heroku project settings.

dmlittle
  • 964
  • 6
  • 15