http-redirectindexingstructuredefaultumbraco

How to set up Umbraco to default in a subpage?


I have this question about umbraco structuring and I can't find the answer anywhere.

Typically in Umbraco it will default the root site to the first node of the tree. so if we have

the default page will be home (so www.mysite.com will point to home).

How do I change this however so that www.mysite.com will point to page1 or page2? What if I have this structure?

and I want www.mysite.com to go straight to www.mysite.com/index.aspx

I couldn't find a rule that does that. Tried inserting a rewrite/redirect rule and it didn't change anything.

Please help

Nick


Solution

  • 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 : https://our.umbraco.com/Documentation/Reference/Routing/Routing-Properties/

    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.example.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.example.com/ to http://www.example.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.example.com/index.aspx");    
        }
    </script>
    

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