I am trying to deploy a static website. I have activated the pretty url option but all my pages are still available with the .html, or /index.html for directories, in addition to the url-less version.
I have read in the docs about redirects and rewrites that url prettifying should be handled via this option, but I can’t make it work and having both urls, with and without extension is really bas SEO-wise.
Hey @buzut, if you have Pretty URLs enabled, people will not get to the .html versions of your pages from your site since we rewrite the HTML of your site to strip the .html extension away. They would only get to those pages if they type them in directly. You could try adding a 301 redirect for every file ending in .html, but it seems like a lot of work for minimal benefit. For each article or post, you’d have to do something like this, and even then you may hit an infinite loop problem since you’re redirecting to the same page:
/article.html /article 301!
This is also not something our redirects would parse:
/*.html /:splat 301!
Since you’re thinking about SEO, I did want to share this post by our CTO about a canonical link header we rolled out for when you enable a custom domain on your site- might be of interest to you :
Hope this helps! Please let us know if we can answer any other questions on this.
I’m wondering what should our internal links look like?
I have pretty URL enabled which makes /about serve contents of /about.html.
My users aren’t typing in the links with .html extension, but the links I give them internally have the extension.
If I strip .html extension from all the internal links, the production site on netlify works perfectly, but it makes the development setup unusable because none of the links work without the extension (locally).
I’m using a basic webpack based static site boilerplate to build my site.