vuepress / vuepress-community

:bulb: Community supported ecosystem for VuePress
https://vuepress-community.netlify.app
MIT License
81 stars 62 forks source link

[Question] plugin-redirect: How to force redirect to a subdirectory #109

Closed DynamicLoader closed 2 years ago

DynamicLoader commented 2 years ago

Environment

What's your question?

Hi, I'm trying to force redirect to a subdirectory. Here is the structure of directories:

 |- .vuepress
           |- config.js
           |- dist
                |- categories
                         |- All (Dir)
                         |- C51 (Dir)
                         |- index.html

What I want to do is redirect from /categories/ to /categories/All/. But,as you can see,there is a index.html in the directory categories,which is generated by the plugin blog (Offically maintained). When I open http://localhost:8080/categories/,it does NOT redirect to '/categories/All/'.

Is there something I did wrong? How can I make it?

Additional infomation

Here is a section of my config.js:

        plugins: {
        'vuepress-plugin-nuggets-style-copy':{
            copyText: "Copy code",
            tip: {
                content: "Copied!"
            }
        },
        'redirect': {
            redirectors: [
                {
                    base: '/categories/',
                    storage: true, 
                    alternative: [
                        'All', 
                    ],
                },
            ],
        }
    },

Here are some output when I run vuepress build .

wait Extracting site metadata...
tip Apply theme vuepress-theme-reco ...
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/p
components") ...
tip Apply plugin @vuepress-reco/back-to-top (i.e. "@vuepress-reco
n-back-to-top") ...
tip Apply plugin @vuepress-reco/pagation (i.e. "@vuepress-reco/vu
agation") ...
tip Apply plugin @vuepress-reco/comments (i.e. "@vuepress-reco/vu
omments") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/p
ader-links") ...
tip Apply plugin @vuepress/medium-zoom (i.e. "@vuepress/plugin-me

tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-npro
tip Apply plugin @vuepress/blog (i.e. "@vuepress/plugin-blog") ..
tip Apply plugin smooth-scroll (i.e. "vuepress-plugin-smooth-scro
tip Apply plugin nuggets-style-copy (i.e. "vuepress-plugin-nugget
...
tip Apply plugin redirect (i.e. "vuepress-plugin-redirect") ...
tip Apply plugin dehydrate (i.e. "vuepress-plugin-dehydrate") ...

Thanks.