I wanted to ask you for your help. I found this answer that is recommended on the internet - Forward naked domain with URL path for my Google Domain but it seems that it is already outdated.

I tried a lot of things, I was using NakedSSL, wwwizard and I even transfered my domain from my local provider to google domains. No matter what I do, I am not able to set all 3 possibilites to nice 301 redirect (and one 200). This is my best result currently:

Structure Redirect
https://example.com 301
https://www.example.com 200 (my preffered format)
http://example.com 301
http://www.example.com 302

Here is my current setup:

  1. I added to DNS record www | CNAME | my_server_address
  2. I added google forwarding from example.com to https://www.example.com with 301 | Forwarding Path | SSL On

The thing is, I have no idea how to force http://www.example.com to also give me a 301. I am also not sure which entry controls this http://www. I tried adding it second times to DNS, I tried adding it as the additional record in google forwarding but either the google domains system complains about structure and doesn't let me save it or it simply is not doing anything.

Could someone please point me in the right direction?


My domain provider is now Google Domains

My hosting provider is PythonAnywhere (therefore I am given only CNAME (without A tag) and I don't have access to nginx). I am also using free SSL certificate and have option force HTTPS turned on.

  • There is no DNS entry that causes redirects alone. When you choose Google forwarding, you are assigning the name to point to their server and having their server issue the redirect. You won't be able to forward http://www using DNS entries. See this answer for a full explanation. What type of hosting and web server are you using for your site? Commented Feb 14, 2023 at 9:54
  • @StephenOstermiller Thank you for your comment, I added missing information in edit (at the bottom of my question)
    – Peksio
    Commented Feb 14, 2023 at 10:10
  • Are you using their "force HTTPS" feature as described here? Commented Feb 14, 2023 at 11:01
  • @StephenOstermiller Yes, that is correct. Also it is described here - help.pythonanywhere.com/pages/ForcingHTTPS And I have also turned on option - HTTPS certificate: Auto-renewing Let's Encrypt certificate
    – Peksio
    Commented Feb 14, 2023 at 11:19

1 Answer 1


PythonAnywhere's "Force HTTPS" feature is evidentially is implemented with a 302 redirect. You have three options:

  1. Don't worry about it. A 301 redirect is the gold standard for SEO, but unless your site has tons of old historical links to http:// pages, it is very unlikely that you are getting any SEO value from that redirect. In any case search engines understand 302 redirects well enough.

  2. Contact their customer support and beg them to change that feature to use a 301 redirect instead of a 302 redirect.

  3. Disable the "Force HTTPS" feature and implement the redirects yourself. You should be able to put redirect code into Python. It should check that the current URL doesn't have HTTPS and issue a 301 redirect to your preferred URL. You would normally check environment variables or headers like SERVER_PORT==80; or HTTPS!=on; or if you are using a CDN or load balancer,X-Forwarded-Proto!=https.

  • Thank you for your answer! At. 1 Actually I think that I don't have a single link like that posted anywhere. I was just curious if this can be done better. 2 So it seems that it is actually fault of my infrastructure provider. It is not a deal breaker by any means but I wonder why the decided to set it as 302. 3 I will keep that in mind as well. Thank you!
    – Peksio
    Commented Feb 14, 2023 at 15:03
  • 302 redirects are the default for most web server configuration and programming frameworks. Developers usually have to pass an additional flag to say the redirect should be 301. It is not surprising when developers come out with a 302 rather than a 301. Commented Feb 14, 2023 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.