Skip to content

Existing .html Redirect #18

Open
Open
@adam-stamand

Description

@adam-stamand

Is there a way to redirect to an existing .html file? I previously used the now deprecated redirect: in the .md file to redirect to an .html that was already generated using other software. From what I can tell, this plugin only allows you to specify .md files, which effectively would prevent me from using raw .html redirect.

For example, if I have an .html file called /docs/content/page.html and I want an index.html generated by mkdocs to redirect to it, I previously just put redirect: page.html in /docs/content.md, and I would automatically be redirected to page.html when I navigated to the /docs/content page.

Is there any way to achieve this effect with the mkdocs-redirects plugin?

Activity

adam-stamand

adam-stamand commented on Dec 8, 2020

@adam-stamand
Author

Note that one workaround is to place <meta http-equiv="refresh" content="0; URL=page.html" /> inside the .md file for redirection. This solution doesn't require the plugin at all, though I'm still curious if the plugin supports this pattern.

JC5

JC5 commented on Jan 10, 2021

@JC5

I am also curious about this. I have several old pages in this format: /en/latest/installation/docker.html.

It is impossible to create a redirect for those.

prcr

prcr commented on Apr 23, 2021

@prcr
Contributor

Besides *.md files, mkdocs-redirects also allows you to redirect to full URLs. So a quick workaround would be to do redirects like in this example:

plugins:
    - redirects:
          redirect_maps:
              "content.md": "https://example.com/content/page.html"
              "en/latest/installation.md": "https://example.com/en/latest/installation/docker.html"
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @JC5@adam-stamand@prcr

        Issue actions

          Existing .html Redirect Β· Issue #18 Β· mkdocs/mkdocs-redirects