Redirect from .html to / (Vuepress)

Hey Team,

I have a static website deployed and currently the URLs have ‘.html’ extension in the URL bar. I want to put a redirect from ‘.html’ to ‘’.

I added the redirect in _redirects and I can see the message on deploy - ‘xx redirect rules successfully processed’. However, the redirect isn’t working.
Am I missing something here?

The presence of both ‘.html’ and ‘’ is causing the issue of duplicate content for SEO. And I need ‘<url.html>’ to be a valid redirect (and not a 404) since I have pages linking to the URL.

The website I am talking about is freelancer-report.flexiple.com and a sample URL is Freelance Market Statistics & Trends [Updated for 2022].

A rule in my _redirects file looks like this -
/2-current-trends.html /2-current-trends

Not sure if it is relevant, but since the netlify url is also asked, here you go: https://wonderful-curie-583b93.netlify.app/

@karthiks It sounds as though you should have used Asset optimization (in Build & Deploy in your Netlify dashboard) instead of redirects.

This will give you the “pretty” URLs you seem to want.

Then you should hard-code the canonical URL in each file, which will eliminate the “duplicate content” issue.

1 Like