3

如何转发网址,例如:

http://www.mysite.com/加入

到相应的页面:

http://www.mysite.com/JoinOptions/MemberRegistration.aspx

有没有办法做到这一点?

我正在使用 DNN CMS,但如果您不熟悉 DNN 并且仍然有重定向解决方案,那将很有帮助。

谢谢,
马特

4

6 回答 6

4

您可以在 DNN 中创建“友好 URL 规则”。在主机设置页面中,打开高级设置部分中的友好 URL 部分。从那里你可以添加一个新规则,匹配.*/Join/Default.aspx并替换它~/JoinOptions/MemberRegistration.aspx(我很确定使用这种 URL 样式会起作用,但我知道你可以用类似的 URL 替换~/Default.aspx?tabid=423)。

使用此方案,您需要确保 IIS 允许 ASP.NET 处理请求。最简单的方法是在文件系统中添加一个“Join”文件夹,其中包含一个名为 Default.aspx 的文件。

于 2010-02-03T13:59:49.050 回答
1

我们曾经使用过 SnowCovered 的 DNN 模块,您可以在此处获取:http ://www.snowcovered.com/Snowcovered2/Default.aspx?tabid=242&PackageID=7262

它是 15 美元,但无需任何编码即可满足您的需求。

您将创建一个页面/Join并将其重定向到/JoinOptions/MemberRegistration.aspx

于 2010-02-02T22:14:36.183 回答
0

如果您使用的是 Apache,您可以创建或编辑现有的 .htaccess 文件,其中包含:

RewriteEngine on
redirect 301 /Join http://www.mysite.com/JoinOptions/MemberRegistration.aspx

并将其放在您的根目录(http://www.mysite.com/指向的目录)中。除此之外,阅读 Apache .htaccess 文件mod_rewrite可能很有用。

编辑:哎呀。没有检查标签。

于 2010-02-02T22:07:56.683 回答
0

如果你在 IIS 上,你可以使用 ISAPI_Rewrite3 工具。该站点的 .htaccess 将是:

RewriteBase /
RewriteRule ^Join/?$ JoinOptions/MemberRegistration.aspx [NC,R=301,L]
于 2010-02-03T07:22:23.870 回答
0

Actually without touching IIS and without spending any money you can do this with a little trickery.

  1. Create a folder called JOIN at the root
  2. Add a page called default.aspx in that folder
  3. add the code below

    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    
        Dim DomainName As String = Null.NullString
            Dim ServerPath As String
            Dim URL() As String
            Dim intURL As Integer
    
            ' parse the Request URL into a Domain Name token 
            URL = Split(Request.Url.ToString(), "/")
            For intURL = 2 To URL.GetUpperBound(0)
                Select Case URL(intURL).ToLower
                    Case "admin", "desktopmodules", "mobilemodules", "premiummodules"
                        Exit For
                    Case Else
                        ' check if filename
                        If InStr(1, URL(intURL), ".aspx") = 0 Then
                            DomainName = DomainName & IIf(DomainName <> "", "/", "") & URL(intURL)
                        Else
                            Exit For
                        End If
                End Select
            Next intURL
    
            ' format the Request.ApplicationPath
            ServerPath = Request.ApplicationPath
            If Mid(ServerPath, Len(ServerPath), 1) <> "/" Then
                ServerPath = ServerPath & "/"
            End If
    
            DomainName = ServerPath & "JoinOptions/MemberRegistration.aspx"
    
            Response.Redirect(DomainName,True)
    
    End Sub
    

If you change the Page name you would have to re-edit the file but it works

note:might have to replace the amersan amp with an actual ampersand

于 2010-02-02T23:09:01.130 回答
0

又一个选择。可能比公认的答案多一点黑客攻击。

在 IIS 中启用通配符映射

这允许无扩展的 URL 工作(例如http://yoursite.com/Join

  1. 网站->右键->属性
  2. 主目录选项卡 -> 配置
  3. 映射选项卡 -> 通配符部分 -> “插入”
  4. 浏览到 aspnet_isapi.dll(参见下面的示例路径)-> 选择文件
  5. 取消选中“验证文件是否存在”复选框
  6. 好的 好的 好的 直到完成 -> 关闭 IIS 窗口

在 DNN 中创建一个名为“Join”的页面并将其重定向到所需页面

添加一个名称/标题加入的页面,将其设置为不显示在菜单中,并将其设置为 301 重定向到您想要的 URL(这些都是页面设置中的所有选项)

* 通常类似于 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

于 2010-02-24T04:24:34.147 回答