【问题标题】:Joomla 2.5 - Disable www.[websitename].com/?format=feed&type=rssJoomla 2.5 - 禁用 www.[websitename].com/?format=feed&type=rss
【发布时间】:2012-06-05 22:41:03
【问题描述】:

我一直在寻找一种方法来禁用提要链接(即:www.[websitename].com/?format=feed&type=rss)。

有没有办法禁用此链接?我有一些糟糕的谷歌索引,当谷歌再次尝试索引它们时,我想返回 404 not found。

【问题讨论】:

    标签: joomla


    【解决方案1】:

    尝试编辑libraries/joomla/document/feed/feed.php 文件。

    在文件中找到JFeedDocument类的__construct方法,修改如下:

    function __construct($options = array()) {
      JError::raiseError(404, JText::_('Resource Not Found'));
    }
    

    但是,在这种情况下,您根本没有“饲料”支持。

    【讨论】:

    • 没有提要支持不是问题。我尝试了您的建议,但它导致了很多错误,而不是传统的 404 未找到。
    • 能否提供错误详情?我试过 1.5 而不是 2.5。
    • 您要禁用对提要链接的访问还是禁用提要创建?
    • 我想禁用对该链接的访问。我有一个 www.[websitename].com/?format=feed&type=rss 的谷歌索引,我想摆脱它。
    【解决方案2】:

    以防万一有人在外面寻找这个,对我有用的是在 JDocumentFeed 构造函数中设置 404 Not Found 标头:

    function __construct($options = array()) {
        if (!headers_sent()) {
            header('HTTP/1.0 404 Not Found');
            //I guess you could include here a file to show the 404 page
        }
        exit();
    }
    

    JError::raiseError(404, JText::_('Resource Not Found')); 的调用给了我错误的回溯。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-15
      • 2012-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多