Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用xpath设置404页面_Xpath_Umbraco_Umbraco7 - Fatal编程技术网

如何使用xpath设置404页面

如何使用xpath设置404页面,xpath,umbraco,umbraco7,Xpath,Umbraco,Umbraco7,我正在使用Umbraco 7.5.2,我正在尝试设置一个自定义404页面。 我在同一个Umbraco上托管了两个完全不同的站点 我已在后台创建了我的页面类型和页面,并在umbracoSettings.config中添加了以下内容: <errors> <error404>//errorListFolder/page[@nodeName = '404']</error404> //errorListFolder/page[@nodeName='

我正在使用Umbraco 7.5.2,我正在尝试设置一个自定义404页面。 我在同一个Umbraco上托管了两个完全不同的站点

我已在后台创建了我的页面类型和页面,并在umbracoSettings.config中添加了以下内容:

 <errors>
       <error404>//errorListFolder/page[@nodeName = '404']</error404>

//errorListFolder/page[@nodeName='404']
它将在errorListFolder正下方的type page中找到名为404的页面

但我的两个站点的此页面都是相同的(显示第一个站点上的页面)。如何修复它以在每个站点上显示相关错误页面

我试过了

  <error404>$site//errorListFolder/page [@nodeName='404']</error404>
$site//errorListFolder/page[@nodeName='404']
但它没有找到任何东西,我将以umbraco的基本错误页面结束

这是我的结构(为了简单起见,我删除了其他节点)

评论 多亏了Marcin,我可以用Nibble.Umbraco.PageNotFoundManager修复它。这是一个很棒的工具!但我需要指出的是,您必须手动将umbracoSettings.config设置回正常状态,否则它将无法工作


我在那个文件中有xpath,无论我在后台选择什么,我都看不到我的页面。然后我将其改回1,它就像一个符咒一样工作:)

您可以通过从$root元素访问特定的树。从我们的一个项目中检查我的解决方案:

<error404>
    <errorPage culture="pl-PL">$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
    <errorPage culture="en-US">$root/homePage[@nodeName='EN']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
    <errorPage culture="default">$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
  </error404>

$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR-808']
$root/homePage[@nodeName='EN']/hTMLContentPage[@nodeName='content-notfound-TERROR-808']
$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR-808']
它从“homePage”类型的节点和上面可以看到的特定节点名中获取第一个原始名称为“content not found TERROR-808”的节点

对于您的场景,您应该尝试使用Tim Geyssens(uHangout:)制作的Umbraco Page Not Found Manager。也许这就是你要找的东西。在配置文件中使用基本的error404设置来安排它可能很困难,甚至是不可能的,特别是如果您想根据404以前访问的树节点来保留一些区域性的话


希望它能帮助你

您可以从$root元素访问特定的树。从我们的一个项目中检查我的解决方案:

<error404>
    <errorPage culture="pl-PL">$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
    <errorPage culture="en-US">$root/homePage[@nodeName='EN']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
    <errorPage culture="default">$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
  </error404>

$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR-808']
$root/homePage[@nodeName='EN']/hTMLContentPage[@nodeName='content-notfound-TERROR-808']
$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR-808']
它从“homePage”类型的节点和上面可以看到的特定节点名中获取第一个原始名称为“content not found TERROR-808”的节点

对于您的场景,您应该尝试使用Tim Geyssens(uHangout:)制作的Umbraco Page Not Found Manager。也许这就是你要找的东西。在配置文件中使用基本的error404设置来安排它可能很困难,甚至是不可能的,特别是如果您想根据404以前访问的树节点来保留一些区域性的话


希望它能帮助你

谢谢你的回答。这对我不起作用。我有两个不同的领域。这不仅仅是文化或语言。你能帮我吗?当然。你能展示一下树结构的样子吗?基本上只需要XPath来访问所需的节点。应该没问题:)谢谢你的回答。这对我不起作用。我有两个不同的领域。这不仅仅是文化或语言。你能帮我吗?当然。你能展示一下树结构的样子吗?基本上只需要XPath来访问所需的节点。应该没问题:)