jekyll / jekyll-redirect-from

:twisted_rightwards_arrows: Seamlessly specify multiple redirections URLs for your pages and posts.
MIT License
781 stars 112 forks source link

redirect_to downloads a link instead of redirecting #122

Closed alexlenail closed 7 years ago

alexlenail commented 7 years ago

Is this expected behavior? Try for example fraenkel-lab.github.io/steinernet

parkr commented 7 years ago

It's because it's not written as an HTML document. You should say redirect_from: /steinernet.html and ensure the server tries $url.html so that when $url = "/steinernet", it will properly look for /steinernet.html and serve it with Content-Type: text/html. This is how it works for the Jekyll development server (jekyll serve) and for GitHub Pages.

Hope this helps!

alexlenail commented 7 years ago

@parkr Do you mean redirect_to ?

parkr commented 7 years ago

@zfrenchee redirect_to should be left alone, but the file the redirect_to is in should end in .html, e.g. /steinernet.html would contain redirect_to: <url>.

alexlenail commented 7 years ago

@parkr Hmm I'm confused about this. I tried what you suggest in your most recent comment, and it doesn't work. Navigating to fraenkel-lab.github.io/steinernet now still downloads a link, and navigating to fraenkel-lab.github.io/steinernet.html gives me a blank page on the jekyll site.

The source is here. Perhaps I'm messing this up with the permalink in the front matter?

parkr commented 7 years ago

@zfrenchee The problem is that it's not being output with an HTML extension to the filesystem. You didn't mention that you had set permalink. Try permalink: /steinernet.html.

alexlenail commented 7 years ago

Thanks! That solves it for me!

parkr commented 7 years ago

You're welcome! Sorry for that little snafu.