Skip to content

Allow redirections to external URLs #1844

@Lucidiot

Description

@Lucidiot

Bug Report

Environment

Zola version: 0.15.3

Expected Behavior

Tell us what should have happened.

When setting redirect_to on a section's _index.md to an external URL, the redirection page should redirect to the external URL.

Current Behavior

Tell us what happens instead of the expected behavior. If you are seeing an
error, please include the full error message and stack trace. You can get the
stacktrace of a panic by adding RUST_BACKTRACE=1 when running a zola command.

The site's base URL gets concatenated to the external URL: with a base URL at https://foo.com and redirect_to = "https://bar.com/something", the user gets redirected to https://foo.com/https://bar.com/something.

Step to reproduce

Please provide the steps to reproduce the issue.
If the issue is hard to reproduce, please provide a sample repository or sample
that triggers the bug.

  1. Set the site's base URL to https://foo.com

  2. Create an _index.md anywhere in a site's content, and set a redirection:

    +++
    redirect_to = "https://bar.com/something"
    +++
    
  3. Generate the site.

  4. Open the section that you created.

You will get redirected to https://foo.com/https://bar.com/something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions