3

How would be possible using js (in admin,cms-page) to redirect the 404 page to home page?

6

you can add set setTimeout

<script type="text/javascript">
 function scr(){

  window.location = "http://www.yoururl.com";
 }

  setTimeout(scr,10000);
</script>
  • Can you enhance the code and alter the way you specified the url? – Zinat Oct 6 '16 at 5:51
  • 1
    @Zinat gopal patel already mentioned. – Qaisar Satti Oct 6 '16 at 6:03
2

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>
  • why added the jQuery? – Qaisar Satti Oct 6 '16 at 6:05
  • 1
    Upppps have habit to add jQuery... – Gopal Patel Oct 6 '16 at 6:08
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.