How to set up Umbraco to default in a subpage?

二次信任 提交于 2019-12-05 05:36:38

Redirecting in Umbraco is usually a very simple affair, except when you're trying to redirect from the root node of your site.

Method 1:

It explains it best here : http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracoredirect

So it's possible by adding a umbracoInternalRedirectId property to your root node, with the data type of Content Picker. Note that it does not redirect the user but instead load the contents of that page inside the current url. So the URL will remain as http://www.mysite.com whilst serving the contents of the page that you want to redirect to.

Method 2:

If you really want it to change from http://www.mysite.com/ to http://www.mysite.com/index.aspx. I usually add something like the following code to the template of the root node.

<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
</asp:Content>
<script type="c#" runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Redirect("http://www.mysite.com/index.aspx");    
    }
</script>

So that ASP.Net is responsible for the redirect. But it obviously won't handle node rename/moving too well.

you can redirect to any page using Url Rewriting Config/UrlRewriting.config

adding this Role

<add name="role1"
  virtualUrl="^~/$"
  destinationUrl="~/home"
  redirect="Application"
  redirectMode="Permanent"
  ignoreCase="true" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!