如何在子页面中将Umbraco设置为默认值? [英] How to set up Umbraco to default in a subpage?

查看:214
本文介绍了如何在子页面中将Umbraco设置为默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有关于umbraco结构的问题我无法在任何地方找到答案。



通常在Umbraco中,它会将根网站默认为第一个节点树。
所以,如果我们有




  • 主页

    • 第1页

    • 第2页




默认页面将是home(所以www.mysite.com将指向home)。



我如何改变这一点,以便www.mysite.com指向page1或page2?
如果我有这个结构怎么办?




  • 包装器

    • index

    • 第1页

    • 第2页




我希望www.mysite.com直接访问www.mysite.com/index.aspx



我不能找到一个这样做的规则。尝试插入重写/重定向规则并没有改变任何内容。



请帮助



Nick

解决方案

在Umbraco中重定向通常是一件非常简单的事情,除非您尝试从站点的根节点重定向。 / p>

方法1:



这里解释得最好: http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracoredirect



因此可以通过向根节点添加 umbracoInternalRedirectId 属性,其数据类型为Content选择器。请注意,它不会重定向用户,而是在当前URL内加载该页面的内容。因此,URL将保留为 http://www.mysite.com ,同时提供您要重定向到的页面内容。



方法2:



如果您真的希望它从更改http:// www.mysite.com / http://www.mysite.com/index.aspx 。我通常会将以下代码添加到根节点的模板中。

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

这样ASP.Net就负责重定向。但它显然不会处理节点重命名/移动得太好。


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

  • Home
    • page 1
    • page 2

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?

  • wrapper
    • index
    • page 1
    • page 2

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

解决方案

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.

这篇关于如何在子页面中将Umbraco设置为默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆