Problem with Pretty URLs

The Pretty URL feature is not working for my website https://imaginadaycare.net/. For example if you click the ‘About Us’ page it goes to /about.html instead of /about. I have Pretty URLs enabled. Any ideas on what I can to do fix?

Please don’t create multiple threads on the same topic @gamwebsites. You have already asked this question previously which @nathanmartin has assisted you with

sorry, wasn’t sure what to do because none of those answers solved my issue, was hoping someone else might know the answer.

Have you tried using the search facility to see if there are other relevant answers on previous threads?

yeah I have found similar issues, but no solutions that fixed the problem, but I can try looking again

Would you buy an egg and cheese sandwich only to take the cheese out because you don’t like it? Probably not, because that’s just silly.

Likewise, why would you include .html on links in a site when you don’t want them there?

Ergo, my first suggestion to you is to use URLs (relative and absolute) in the site you’ve deployed that don’t have an extension if you don’t want the paths people see in the address bar of a browser to have them.

So instead of

<a class="cs-li-link" id="active" href="/index.html">Home</a>

have

<a class="cs-li-link" id="active" href="/">Home</a>

Build it the way you want it rather than relying on an add-on to tweak it for you.

1 Like

yeah I see what your saying and saw you mention that a couple days ago. One question is how do you test it locally? At least the way I have it set up (VS Code - liver server) the pages won’t load without having the .html locally

@gamwebsites I don’t think I asked you how you’re deploying the site.

Are you building locally and then deploying the already built files (via CLI or “Drag & Drop”) or do you have a repository linked on Netlify which is performing a build?

repo on GitHub linked to Netlify which performs the build

Use something like serve or http-server or netlify-cli

Excellent, I’d imagine the post-processing should be occurring then, provided you have it turned on correctly and there’s nothing else out of the ordinary.

I only check because I’ve always assumed that Netlify skips post-processing when people supply their own complete package for deployment.

As @jasiqli suggests you could create your files without the extensions in the links, which would prevent you needing to rely on the Netlify post-processing, but it really should “just work”.

This is Netlify’s motto isn’t it?

Search “just works”

thanks I’ll take a look at those. Do you have a personal preference that you use?

I use all three. If you are deploying to Netlify, the Netlify CLI is the best as it enables using functions, redirects, headers and other features locally too.

Thanks for the help!!

Was able to solve the problem enabling asset optimization. May be a bug because Pretty URLs should work without asset optimization, but if anyone is having similar issue try enabling asset optimization.

It’s why I advised that you do exactly that here:

It absolutely used to be a child item of ‘Asset Optimization’, and having it turned off would cause Netlify’s build process to skip ‘Pretty URLs’ handling.

It’s possible it has been moved in the UI, promoted to exist as a sibling of ‘Asset Optimization’, but hasn’t been changed in the actual implementation.

Yeah I tried that solution at the time and it didn’t work, but I had the same problem occur with a different website and the solution did work. Not sure what the difference is.

Yup seems implementation doesn’t match UI