Forums

How to point my domain to pythonanywhere without www prefix

Hi there,

I have already created a CNAME record to point www on my domain to my python application. However I would also like to point the domain itself (with no www prefix) to it. Is that possible? I admit I'm not too familiar with DNS settings. It used to point to a site hosted somewhere else, but I'm moving it here.

Thanks!

Creating a CNAME for a "naked" domain like that isn't permitted in the RFCs - see this question and answer for some discussion and a quote from the relevant standard.

If your DNS provider offers any kind of HTTP-level redirection then you could use this to send a permanent redirect from the naked version to the www version. This essentially entails them setting the A record for your naked domain to the IP address of a webserver they host, and have this server send nothing but redirects. I'm not sure if all DNS hosts provide this, however. Here's an example for setting it up on GoDaddy.

+1 to what Cartroo says. A catch-all redirect (so that when people go to http://yourdomain.com/something they are redirected to http://www.yourdomain.com/something) is definitely the best solution, for two reasons:

  • You can only point the "naked" yourdomain.com domain to a fixed IP address. This makes it harder for us to load-balance your site by by moving it from machine to machine.
  • If you have two sites with the same content, yourdomain.com and www.yourdomain.com, then when people link to you they can use either one. This means that you could wind up with 50% of your incoming links going to the naked domain, and 50% to the www one. This in turn means that half of the pagerank Google-juice will wind up associated with one version of the site, and half with the other -- so you'll wind up further down the search results than you would if it was all concentrated on one of them. (I've also heard, but can't confirm, that because Google try to spot sites that just duplicate other ones for spamming purposes, having your site apparently available in two places can reduce the pagerank even further, so you wind up with less than half the pagerank you would otherwise get)

If you'd like us to help with setting up a redirect, drop us a line here on the forums or privately via the "Send feedback" link letting us know who your registrar is and we'll see if we can find out how to do it.

I contacted my registrar (pairNIC) and was able to set up the redirection as suggested.

Just to clarify, those issues above are both resolved because the redirection occurs on their webserver and from the view of pythonanywhere, everything is coming from www.yourdomain.com. Is that correct?

Thanks for your help!

Yup, from the point of view of PythonAnywhere (and Google) your content will all be served from www.yourdomain.com

Can anyone help me with this? My website www.eabsentee.org works well, but eabsentee.org does not. I'm using NameCheap. I've tried adding a redirect but it's not working. Here is my redirect: https://ibb.co/SKKkHm7

That's not working because your web app is at https://www.eabsentee.org. Both of those redirects are going to a site that does not exist. If you make that redirects go to https://www.eabsentee.org, then it should work.

Please I would love to redirect my web app from https\:vintechblog.com to www. vintechblog.com. I bought domain name from GoDaddy.

This site provides a free service that you can use to do that: NakedSSL.

hello, I'm using Godaddy for my domain, I was able to set a redirection from mydomain.com to www.mydomain.com but when I type mydomain.com/something, it gives me 404 error, It only works if I add www before.

So how can I make routed URL without www (mydomain.com/something) redirects automatically to the same routed URL but with www (www.mydomain.com/something)?

That just sounds like godaddy only redirect for the root url. You will need to use one of the other options here: https://help.pythonanywhere.com/pages/NakedDomains/

Is there another way?, I tried nakedssl.com but it keeps saying "We can't redirect your domain. Check your URL again and ensure you have a SSL certificate installed."

by the way my site is http not https

What about http://wwwizer.com/naked-domain-redirect? It's also mentioned on that page.

oh, I didn't know how I didn't notice wwwizer, anyways thanks!, it worked for me.

Glad to hear that!

Hi,

I'm sticking with the default domain given for my webapp (username.pythonanywhere.com). Is there any way to setup a redirect for the www subdomain for that?

No you cannot do that.

To OP,

I was able to achieve this using NameCheap.

  1. Go to Advanced DNS
  2. Add an A Record with Host equal to yourdomain.com and add the IP address of your website (included in the output of ping yourdomain.com)
  3. Save

To the PythonAnywhere staff, do site IP addresses change? If so, this solution is only temporary.

Not often, but sometimes, that's why we use CNAMEs.

Hello i have same issues and my site does'nt show up wihout www And i texted godaddy for this issue and they said me that: "Yes, you need to remove that forwarding and then you need to add the A record provided by the hosting provider."

my domain: mspazaryeri.com my app hostname: webapp-1643567.pythonanywhere.com.

i will remove the forwarding and i waiting for the A record , can u help me?

We do not recommend using A records. See https://help.pythonanywhere.com/pages/NakedDomains/