Joomla 网站中的假链接被重定向到主页

Joomla 网站中的假链接被重定向到主页,joomla,virtuemart,Joomla,Virtuemart,网站中的假链接被重定向到主页,但我希望它重定向到404错误页面。我已经尝试了一切,但重定向发生在主页上 在htaccess.txt中I添加了以下内容: ErrorDocument 404 /index.php?option=com_content&view=article&id=16 in the root defined('_JEXEC') or die; if (($this->error->getCode()) == '404') { header(

网站中的假链接被重定向到主页,但我希望它重定向到404错误页面。我已经尝试了一切,但重定向发生在主页上

htaccess.txt中
I添加了以下内容:

ErrorDocument 404 /index.php?option=com_content&view=article&id=16 in the root
defined('_JEXEC') or die;

if (($this->error->getCode()) == '404') {
    header('Location:/index.php?option=com_content&view=article&id=16');
        exit;
}
同样在templates/root文件夹
error.php
中,我添加了以下内容:

ErrorDocument 404 /index.php?option=com_content&view=article&id=16 in the root
defined('_JEXEC') or die;

if (($this->error->getCode()) == '404') {
    header('Location:/index.php?option=com_content&view=article&id=16');
        exit;
}

也许实际上有一篇ID为16的文章。如果您只是想测试404错误页面,那么在URL中,使用
com_contents
(末尾带有
s
)重定向到主页。在这种情况下,您在某个地方有一条规则,将所有404重定向到主页。检查Joomla后端中的重定向管理器并确保htaccess文件中没有任何异常检查Joomla后端中的重定向管理器?Joomla admin后端>>组件(顶部菜单)>>重定向