Google search console is now showing a ‘Page with redirect’ indexing error for every page on the site.
URLs on the apex domain, with a trailing slash are indexed correctly
Pages with a problem:
URLs on the apex domain, witih no trailing slash are all shown as ‘page with redirect’
URLs for the www. subdomain, and no trailing slash, are also shown as ‘page with redirect’
Sitemap includes only urls on the apex domain, with a trailing slash.
All the sub-pages in the ‘blog’, ‘therapy’ and ‘team’ directories are generated using createPage().
However I am seeing this problem for all of the pages generated via createPage() as well as all other pages on the site.
How can I get rid of all these ‘page with redirect’ errors?
Our CDN edge nodes do URL normalization before the redirect rules kick in.
If the framework builds files in /[page-name]/index.html rather than /[page-name].html then URLs are treated as /[page-name]/ as opposed to /[page-name]. Thus, redirects will automatically occur.
URLs on the www subdomain will always redirect to the apex when the apex is the primary. (This also happens vice versa when the www is primary domain.) To avoid issues here, decide what domain to use (apex or www) and stick to it when it is printed on letterheads, business cards, added to analytics platforms, social media profiles, etc.
When linking to pages within the site, make sure the pathnames follow the appropriate structure (with-/out trailing slash) as outlined above. If a sitemap exists, make sure the URLs are also in the same format.
I’ve read a lot of the articles etc on trailing slashes. I understand the issues with trailing slashes and why a redirect is necessary.
However what is important for me to know, for SEO is:
How can I get rid of all the ‘page with redirect’ errors in the google search console?
I previously hosted a site on Squarespace, which redirects all the urls with trailing slash to non-trailing slash urls.
This did not create ‘page with redirect’ errors in the google search console
It’s unclear if the ‘pretty urls’ option will change the way these redirects look to Google, will enabling this option help?
However the behaviour you mention for directories vs files does not match what I’m seeing.
For example i have a file at /faq.js which Gatsby generates as /faq/ and there is a redirect from /faq to /faq/
I can confirm pretty urls are enabled on the site and following the steps that Hrishikesh shared should disable pretty urls.
Also, reading the description for Pretty URLs, it is described as a rewrite.
Is it a redirect or a rewrite?
Pretty URLs in Netlify can be considered as rewrites. When you enable the Pretty URLs feature in Site settings > Build & deploy > Post processing > Asset optimization , it rewrites paths like /about.html to /about/ without changing the URL in the visitor’s address bar. This is similar to a rewrite with a 200 status code
The Asset Optimization settings in my Netlify account for the site indicates that Asset Optimization is switched off but you’re indicating it is actually switched on - This is confusing.
Does this mean that all asset optimizations are actually switched on by default?
Also, the response from Hrishikesh is confusing, since the user interface uses the term rewrite, and the question I have is related to redirects. Rewrite and Redirect are both different things, and this difference is important from a Google indexing and SEO perspective.
I will try disabling Pretty URLs as suggested and see if that fixes the issue.
Asset optimization setting has an option to enable/disable all settings with a single control. Yet, pretty URLs isn’t affected by that control, which made the interaction very unintuitive and confusing!
Today, we’ve removed pretty URLs setting from the Asset optimization card and we added a new dedicated section for it so you wouldn’t need to go through the steps shared to disable pretty URLs going forward.
Thanks for taking on my feedback, I’m glad it could be used to improve the site.
I’ve had a look and the change looks good, it’s much clearer and more intuitive now.
I am going to leave pretty URLs switched on for now. I need redirects in place for the non-slash paths since these are referenced in external sites.
I’ve also followed up on this issue with Google.
The feedback I’ve received so far is that these additional paths are not affecting SEO ranking.
However they have made some suggestions for how I can reconfigure my search console settings to remove the www.* paths from being reported, which I’ve done and am just waiting on google to re-crawl the site to see if their suggestion has changed the results.
Have you had any reports of this issue from other Netlify users?