question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

clean-url plugin breaks Netlify deployment

See original GitHub issue
  • I confirm that this is an issue rather than a question.

Bug report

Version

alpha.40

Steps to reproduce

Visit https://compassionate-benz-c091d6.netlify.com/getting-started

What is expected?

A rendered page equal to https://docs.onyxframework.org/getting-started

What is actually happening?

Both websites are deployed via Netlify. https://docs.onyxframework.org is deployed from master branch, https://compassionate-benz-c091d6.netlify.com — from bug branch. The only difference is that the clean-urls plugin enabled in bug branch as seen here: https://github.com/onyxframework/docs/compare/bug.

See https://github.com/onyxframework/docs for the source code.

Other relevant information

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
alberthaffcommented, Mar 3, 2019

I made a little hotfix-script.

Place following in your package.json

"scipts": {
  "build": "vuepress build; npm run urls:pretty",
  "urls:pretty": "find ./.vuepress/dist ! -path './img*' ! -path './assets*' ! -name '_redirects' ! -name '*.*' -type f -exec bash -c 'mv $1 $1.temp; mkdir $1; mv $1.temp $1/index.html' - {} \\;"
}

and run npm run build as usual. The script renames all page from getting-started to getting-started/index.html. It works fine on ngx-buoy.com (hosted with Netlify),

You’ll might have to adjust the filter of the script, so that it doesn’t rename your assets, etc.

You have to disable Netlify’s “pretty URLs” to get rid of the trailing slashes

1reaction
shigmacommented, Mar 2, 2019

@vladfaust

Most of the servers will automatically handle some redirects, e.g. when /foo does not exist:

  • /foo -> /foo.html if exists
  • /foo -> /foo/ if exists

(And to behonest, #1269 does not work on any server.) So if you want a /foo without redirection on Netlify without additional configuration, make sure:

  • /foo exists, and
  • /foo.html and /foo/ does not exist
Read more comments on GitHub >

github_iconTop Results From Across the Web

Redirect Rules for All; How to configure redirects for your static ...
The most common strategy to enable redirects in Netlify is via the _redirects file. ... To enable clean URLs in your Netlify deployed...
Read more >
vue-router with parameter can't run deploy on netlify
I can't call through the website [netlifylink/test/1]. It's "Page Not Found Looks like you've followed a broken link or entered a URL that...
Read more >
Netlify - Devopedia
Functions built on Netlify are deployed to AWS Lambda and made as an API ... with others to run a local build, plugins...
Read more >
Trailing Slashes on URLs: Contentious or Settled?
GitHub Pages, Netlify, and Cloudflare Pages redirect to the trailing slash ... HTTP 404 Error; Potentially Broken Assets (e.g. <img ...
Read more >
If you want to be in full control of your site, static site ...
1) Use Hexo via Netlify. 2) Use Hexo to deploy on Firebase Hosting instead. 3) Use this Hexo Plugin to generate AMP pages....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found