我一直在寻找一种方法来禁用提要链接(即:www.[websitename].com/?format=feed&type=rss)。
有没有办法禁用这个链接?我有一些糟糕的谷歌索引,当谷歌试图再次索引它们时,我想返回 404 not found 。
我一直在寻找一种方法来禁用提要链接(即:www.[websitename].com/?format=feed&type=rss)。
有没有办法禁用这个链接?我有一些糟糕的谷歌索引,当谷歌试图再次索引它们时,我想返回 404 not found 。
万一有人在那里寻找这个,对我有用的是在 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'));
给了我错误的回溯。
尝试编辑libraries/joomla/document/feed/feed.php
文件。
在文件中找到类的__construct
方法JFeedDocument
并将其更改为如下所示:
function __construct($options = array()) {
JError::raiseError(404, JText::_('Resource Not Found'));
}
但是,在这种情况下,您将根本没有“饲料”支持。