Help. Google not indexing my website due to redirects. :(

Google Search Console tells me that Google is not indexing my website due to redirects.

My URL (canonical + sitemap) structure is https://www.domain.com/path/

As an example, when I enter http://airpollution.io/agra into a redirect checking tool. I see this:

http://airpollution.io/agra
**301 Moved Permanently**
https://airpollution.io/agra
**301 Moved Permanently**
https://www.airpollution.io/agra
**301 Moved Permanently**
/agra/
**200 OK**

While I don’t know why google isn’t indexing my website, that last redirect is really confusing me. Why does it only have the /agra/ instead of the full URL?

I have 2 redirects in my static/_redirects file:
https://sad-joliot-b220fd.netlify.com/* https://www.airpollution.io/:splat 301!
http://sad-joliot-b220fd.netlify.com/* http://www.airpollution.io/:splat 301!

Thanks for your help.

Hi, @amritsharma.

The first redirect (from “http” to “https”) is because all sites at Netlify have SSL enforced by default.

The second redirect (from apex/root domain to www subdomain) is because the www subdomain is set as the primary domain here.

The third redirect (from “/agra” to “/agra/”) is because “pretty URLs” is enabled here.

Right now the Google Search Console is treating the official site as using the apex domain where as the site is configured to always use the www subdomain at Netlify.

Have you tried setting the site in Google to https://www.airpollution.io/ (instead of https://airpollution.io/ ) or vice versa (meaning: change Netlify to use the apex domain to match the Google config)?