How to Remove Trailing Slash from URL in Nuxt + Netlify ?

This article is about how to remove a trailing slash from URL in Nuxtjs hosted in Netlify.

If you have a site built with nuxt and hosted or deployed in Netlify, you have probably seen the trailing slash at the end of URL in each pages.

It is not an issue if you have define a trailing slash in all of your links by yourself.

But if you have not then the URL links without the trailing slash will be redirected to a URL will a slash at the end of it . It is automatically add by nuxt.

The redirect will cause a 301 redirect on the pages of your site, which is definitely not a good SEO practice. Your Google Search Console will give you a redirect error and those pages will not be crawled and indexed by google.

Remove trailing slash in Nuxt + Netlify

Since the site is deployed / hosted on Netlify, so the simple solution which I found on answer.netlify.com and have worked for me was to Disable Asset Optimization , but also make sure to explicitly check all the boxes except the “Pretty URLs

 Netlify + Nuxt - Remove trailing slash

IMPORTANT : Simple just checking the “Disable Asset Optimization” without checking the other check boxes, the redirect will still occur.

Once you have the changes as shown in the image above , the changes will take some time to propagate. And once it completed you will not longer be redirected.

Related Topics:

How To Run Netlify CMS Admin Locally?

Hide Admin Path On Deployment In NetlifyCMS.

Scroll to Top