Skip to content

Redirect not work with relative path #8317

Closed

Description

@tisonkun

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

Well, I'm using the 2.0.1 version.

If you open https://pulsar.apache.org/docs/standalone, although its source content is:

---
id: standalone
title: Set up a standalone Pulsar locally
sidebar_label: "Run Pulsar locally"
---

````mdx-code-block
import {Redirect} from '@docusaurus/router';

<Redirect to="getting-started-standalone" />
````

It's redirected to https://pulsar.apache.org/docs/standalone/getting-started-standalone instead of https://pulsar.apache.org/docs/getting-started-standalone.

Moreover, it works well when previewing locally.

Reproducible demo

No response

Steps to reproduce

As described above.

Expected behavior

Correctly redirected to https://pulsar.apache.org/docs/getting-started-standalone.

Actual behavior

Wrongly redirected to https://pulsar.apache.org/docs/standalone/getting-started-standalone.

Your environment

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Nov 10, 2022
  2. slorber commented on Nov 10, 2022

    @slorber
    Collaborator

    This is due to your host doing a server-side redirect to standalone/ so the relative link is resolved client-side in a different way

    CleanShot 2022-11-10 at 12 30 28@2x

    You may have configured trailingSlash incorrectly for your specific host, leading to issues.

    Make sure to read the deployment docs more carefully and configure trailingSlash correctly.

    Make sure all URLs are always served with/without a trailing slash consistently, and adjust your relative links accordingly

    Note we have a client-side redirect plugin, but it's always preferable to use a server-side redirect for such case. If you use GitHub Pages (for which we recommend an explicit trailingSlash config), it's quite limited, and you'd rather use a better, more featured host such as Netlify or Vercel

  3. added
    closed: working as intended
    and removed
    status: needs triage
    bug
    on Nov 10, 2022
  4. tisonkun commented on Nov 10, 2022

    @tisonkun
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed: working as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions