Forums

http://abc.com/ads.txt and https://abc.com/ads.txt not working

Recently realized that my website was not accessible at http://abc.com and https://abc.com (without www) so I updated godaddy domain forwarding to http://www.abc.com Now I can access those two urls without using www which I was having issue with earlier.


Now I am trying to figure out why http://abc.com/ads.txt and https://abc.com/ads.txt isn't working (without www) Below is my urls. py path('ads.txt/', TemplateView.as_view(template_name='stats/ads.txt'), name='ads'),

I am using django default settings. Is there something I need to change in Django to make it work?

Just to clarify the url https://www.abc.com/ads.txt and http://www.abc.com/ads.txt is working (with www)

Take a look at https://help.pythonanywhere.com/pages/NakedDomains/

I have already fixed the non-www link redirect to www redirect using godaddy forwarding so all these urls work: http://abc.com https://abc.com http://www.abc.com https://www.abc.com http://www.abc.com/ads.txt https://www.abc.com/ads.txt

But these are not working: http://abc.com/ads.txt https://abc.com/ads.txt

How they are not working? (You may need to check if GoDaddy supports HTTPS forwarding, as it's not supported by all DNS providers for naked domains.)

I have the same exact problem and have spoken to GoDaddy at length just now.

The frustrating thing is you can't tell Google to use the https://www.abc.com/ads.txt which works.

Is there any alternative solution to this? For some reason the forwarding to www is not done when it's https://abc.com/ads.txt ....but it's done when it's https:/abc.com

I can see that it's working now.

Exactly OxoCube. That's what I am trying to explain here. In order for my ads.txt to get approved, google needs access to the site without www. I really need this fixed. I have done everything correct from goddady's forwarding pov so I am not sure where the problem is. I am pretty sure it's very common so there must be a fix. Can someone please assist here? Someone on reddit said that it needs to be fixed from hosting side FYI: nkahr - abc.com is just a sample not the actual website that I am referring to. The actual website I am referring to is https://www.theworldranking.com.

So the following urls are not working https://theworldranking.com/ads.txt http://theworldranking.com/ads.txt

The following are working (please note that first two without ads.txt, they work! but when I put /ads.txt they don't) https://theworldranking.com http://theworldranking.com https://www.theworldranking.com/ads.txt http://www.theworldranking.com/ads.txt

FYI - I tried this from the other post using cloudflare and it's still not working. https://www.webapptiv.com/django/redirect-non-www-to-www/

I believe GoDaddy doesn't support HTTPS forwarding, so it makes sense that https://theworldranking.com/ads.txt isn't working. I'm curious why http://theworldranking.com/ads.txt doesn't work either.

Could you please share your redirection config? Feel free to email us at support@pythonanywhere.com if you don't want to share it publicly.

It's fine. Hopefully it will help other as well. I assume you are referring to godaddy forwarding Here is the godaddy forwarding

I think you'll need to ask GoDaddy support about that, then. I just checked using curl, and if I request curl -v http://theworldranking.com/ I get what you'd expect from that config -- a redirect to https://www.theworldranking.com/ -- but if I run curl -v http://theworldranking.com/ads.txt I get a 404 not found error, which seems strange.

this is what have been told by godaddy

You should ensure that a redirect is set up correctly in your .htaccess file to forward non-www requests to the www version.

As you are using Python Anywhere as your hosting provider, you might have a different setup process for URL redirection. It's best to consult PythonAnywhere's support documentation or contact the support team for guidance on setting up redirections in your specific hosting environment.

Forwarding: Yes, I have checked and it is correct only. You should ensure that a redirect is set up correctly in your .htaccess file to forward non-www requests to the www version.

Can someone please assist?

The comments about .htaccess files suggest that they don't understand that it is them that is doing the forwarding. Those files would only be relevant if the forwarding was happening on our servers, which it is not.

I've checked the DNS setup for theworldranking.com and can see that it's being handled by two IP addresses belonging to Amazon. Perhaps those are hosts that GoDaddy are using, however. I see from the posts above that @OxoCube managed to get it working, so perhaps there's a setting somewhere that you have to use to say that the path portion of the URL should be retained when sending the redirect response?

@OxoCube Is trying to fix the same issues. I don't think it's resolved yet. This seem like a very common issue so I am a bit surprised that most of the forum post on pythonanywhere don't lead to any solution but rather resources. I would appreciate if someone could assist with this.

We just do not know what GoDaddy are doing under the hood and how he redirection handled by them (if they are able to do that) is configured.

I've still not found a solution for this. I've tried rewriting my Flask application to do the redirect internally as a hack but all my attempt has failed.

Can i ask PAW a quesiton? - Based on information found in your Helps.

We point the CNAME WWW => our webapp-xxxxx.pythonanywhere.com app. Does that mean the A name entries i.e. A @ => some IP address are not required? (as you mentioned above, they point to some Amazon cloud IPs.)

The WWW 'subdomain' would cover all cases of www.mydomain.com but what about the top level 'naked' domain mydomain.com? How's that being handled without a CNAME entry?

No, you won't be able to use A records, since we don't use static IPs. The 'www' CNAME only covers www.mydomain.com, not the naked domain mydomain.com.

So how would i handle the naked domain? i.e. what CNAME entry would i also have to add to allow it to deal with mydomain.com ?

You'd need to set up a redirect, see this help page.