在Middleman中,重定向到我的config.rb中的临时主页无法正常工作

时间:2015-09-11 20:25:59

标签: redirect middleman

最初在我的config.rb中,我有以下内容:

activate :i18n, mount_at_root: false, langs: ['en-us', 'es-mx']
activate :directory_indexes

redirect 'index.html', to: 'en-us'

这适用于将localhost:4567/重定向到localhost:4567/en-us。不过,我实际上想将localhost:4567/localhost:4567/en-us重定向到localhost:4567/en-us/temporary-home-page

在config.rb中更改我以前的重定向工作正常:

redirect 'index.html', to: "en-us/temporary-home-page"

当我尝试添加localhost:4567/en-us的重定向时,它不起作用:

redirect 'en-us/index.html', to: "en-us/temporary-home-page"

我仍以localhost:4567/en-us结束。我也尝试了以下每种组合,结果相同:

redirect 'en-us', to: "en-us/temporary-home-page"
redirect 'en-us/', to: "en-us/temporary-home-page"
redirect 'en-us/index.html', to: "en-us/temporary-home-page"
redirect '/en-us', to: "en-us/temporary-home-page"
redirect '/en-us/', to: "en-us/temporary-home-page"
redirect '/en-us/index.html', to: "en-us/temporary-home-page"

在某些情况下,它会在浏览器中输出:

            <html>
              <head>
                <link rel="canonical" href="en-us/temporary-home-page" />
                <meta http-equiv=refresh content="0; url=en-us/temporary-home-page" />
                <meta name="robots" content="noindex,follow" />
                <meta http-equiv="cache-control" content="no-cache" />
              </head>
              <body>
              </body>
            </html>

我错过了什么?如何将//en-us/en-us/网址重定向到/en-us/temporary-home-page

0 个答案:

没有答案