How redirect the “no-route” cms page to home page after 10 second (not through server side)
-
03-10-2020 - |
Question
How would be possible using js (in admin,cms-page) to redirect the 404 page to home page?
Solution
you can add set setTimeout
<script type="text/javascript">
function scr(){
window.location = "http://www.yoururl.com";
}
setTimeout(scr,10000);
</script>
OTHER TIPS
Edit in @Qaisar Satti's Ans
put this script in no-route cms page content
<script type="text/javascript">
function scr(){
window.location = "{{store url=""}}";
}
setTimeout(scr,10000);
</script>
You can add below code in head.phtml file
<?php if(Mage::getSingleton('cms/page')->getIdentifier()=="no-route"): ?>
<meta http-equiv="refresh" content="10;url=<?php echo $this->getUrl();?>" />
<?php endif;?>
You can make a seperate phtml file for this and add this block file using xml
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange