简体   繁体   English

如何在magento中将404页面重定向到主页

[英]How to redirect 404 page to home page in magento

I am trying to redirect 404 page to home page in magento 1.9. 我正在尝试将404页面重定向到magento 1.9中的主页。

From admin config->web I can set in 'cms no page' to 'Home Page' option and it is redirecting properly. 从admin config-> web,我可以将“ cms no page”设置为“ Home Page”选项,并且它可以正确重定向。

Like, 'www.example.com/abcv' which is 404 page, this redirecting to home page but in browser url is not changing. 就像404页的“ www.example.com/abcv”一样,此重定向到主页但在浏览器URL中没有更改。

I have tried .htaccess to , 我已经尝试过.htaccess,

ErrorDocument 404 /index.php ErrorDocument 404 /index.php

but its not working, 但它不起作用,

ANy suggestion would be great. 任何建议都会很棒。

if the query string is not changing then it is not a redirect. 如果查询字符串未更改,则它不是重定向。

To solve your Issue without backend programming you could create custom 404 cms page and put javascript redirect in it. 要解决您的问题而无需进行后端编程,您可以创建自定义404 cms页面,并将javascript重定向放入其中。

<script type="text/javascript">
function redirectHome() {
  window.location = "{{store url=''}}";
}
setTimeout("redirectHome()", 5000);
</script>

otherwise you will have to write a module and add a custom frontend router 否则,您将必须编写模块并添加自定义前端路由器

Please see 404-Error-To-Home Page-Redirection.png 请参阅404错误首页首页Redirection.png 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM