Google Adsense now requires a file "ads.txt" in the root of the domain:
Upload the file to the root level domain of your site (for example, https://example.com/ads.txt).
I use enom with Google App Engine (python runtime). My main site is with www
as a CNAME www.example.com
and a redirect from naked domain to www
but now I want the naked domain example.com/ads.txt
to redirect to www.example.com/ads.txt
.
The problem is that example.com/ads.txt
redirects without the path to the home page of www.example.com/
.
I don't understand how to fix it. I don't know if it should be done in the enom console, in the Google G Suite console (where I have enabled the redirect from the naked domain to www
) or in my web framework (using webapp2 but changing it to flask).
Related problem is that HTTPS for the naked domain does not work (https://example.com
) and does not redirect, but HTTPS works for the www
and other subdomains.
How can I proceed? The site is this one and it is a Google App Engine project.
I enabled the redirect in the google GSuite web console under "domains" where it says:
Redirect the naked domain
http://example.com
tohttp://www.example.com
Change redirect To enable this redirect, you must change the A record with your domain host.
Apparently the above setting once set cannot be undone. I also set the DNS records exactly as stated by Google. The site does respond at www subdomain and does the redirect but the URL path and query are not preserved.
/ads.txt
should be the same redirect not an additional redirect?/ads.txt
is the path of the URL. It could also have a query string with a question mark like/ads.txt?query=string
, but it sounds like that isn't actually the problem.Server: ghs
) that loses the URl-path and 2. HTTP to HTTPS redirect (Server: Google Frontend
) that preserves the URL-path. (?)