【问题标题】:redirecting old site pages to single page on dnn portal将旧网站页面重定向到 dnn 门户上的单个页面
【发布时间】:2014-03-28 07:12:47
【问题描述】:

我们正在使用 DNN 的社区版。有一堆 html、aspx 页面的旧站点应该(虽然不是全部)重定向到新 DNN 门户 v7.1(301 重定向)中的单个(默认)页面。这是一个例子:

  • www.mysite.com/hello.html -> www.mysite.com
  • www.mysite.com/mypath/hello.html -> 同上
  • 同.aspx页面->同上
  • www.mysite.com/mypath -> 同上

是否可以使用 DNN CE 或 ASP.NET 本身的功能来实现目标?到目前为止,我脑子里只有两件事:

  1. web.config 中的 httpRedirect - 但这只会涵盖 .html 部分,而且只是因为新站点没有使用任何类似的文件

  2. 友好的 url(对 siteulrs.config 进行更改)- 适用于任何有问题的场景,但尽管重定向客户登陆主页后,浏览器的 url 栏一直显示旧 url(我不确定有多好是从 301 SEO 的角度来看)

谢谢!

【问题讨论】:

    标签: url redirect seo dotnetnuke


    【解决方案1】:

    我想不出如何在 DNN 中执行此操作,但您可以使用 IIS URL Rewrite

    使用 URL 重写,您可以通过 IIS 定义各种规则,这些规则将告诉 IIS 何时重定向请求。您可以使用正则表达式或通配符来定义规则,这些规则会写入 web.config。

    类似

    Rule 1: Request to www.mysite.com/hello.html -> Redirect to www.mysite.com
    Rule 2: Request to www.mysite.com/mypath/* -> Redirect to www.mysite.com/{0}
    

    【讨论】:

      【解决方案2】:

      在您的皮肤文件中编写以下代码。

      <script type="text/javascript">
          function pageRedirect() {
              window.location.replace("Your_URL");
          }      
          setTimeout("pageRedirect()", 1000);
      </script>
      

      【讨论】:

        【解决方案3】:

        我想不出比上面指定的更好的解决方案。从 Microsoft 站点安装 URL Rewrite 后,我们能够编辑门户的 web.config(您可以手动或通过 inetmgr 管理单元下的界面进行此操作:

            <rewrite>
                <rules>
                    <rule name="My Rule No 1" patternSyntax="Wildcard" stopProcessing="true">
                        <match url="*helloworld*" />
                        <action type="Redirect" url="/" appendQueryString="false" />
                    </rule>
                </rules>
            </rewrite>
        

        以上部分必须在web.config的system.webServer下添加。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-05-15
          • 2013-02-14
          • 2013-02-10
          • 2020-05-12
          • 2016-12-26
          • 2017-11-29
          相关资源
          最近更新 更多