View Single Post
  #1  
Old 02-19-2005, 03:45 PM
 
walteis walteis is offline
 

Advanced Member
  
Join Date: Jan 2003
Location: USA
Posts: 65
 

Default 404 page for handling bad HTML catalog pages

I don't remember if I posted this before. I've got a 404.shtml that I use to handle bad/old html catalog links. Say we've renamed a product, or no longer carry it, but some index still has that page indexed.

Code:
<script language="JavaScript" type="text/javascript"> <!-- var fileName = ""; if (fileName.search("category|product")== -1) { window.location = "http://yourcartlocation"; } else { fileName = fileName.replace("\.html"," "); var keywords = fileName.split("_"); var searchterms = new Array(); if (keywords[0].search("category")>1) { window.location = "http://yourcartlocation/customer/home.php?cat="+keywords[1]; } else { for (i=2; i<keywords.length-1; i++) { searchterms.push(keywords[i]); } var searchstr = searchterms.join("+"); window.location = "http://yourcartlocation/customer/search.php?substring="+searchstr; } } //--> </script> window.location = "http://www.thingsfromtheattic.com/"

Works on 3.4.x.


Walt
__________________
X-cart Gold 4.1.7 on Linux/Apache.
Reply With Quote