October 09, 2007

Curious George: Website Redirection Troubles I have been instructed to redirect a website I built to another website. Easy enough, right? Nope.

When you do a search for this website, results come up for pages other than index. When these results are clicked on, it goes to www.redirectedsite.com/originalpage.html. The trouble is, this redirected site doesn't have originalpage.html, so all that gets returned is a 404. Aside from contacting the people at this other site and asking them to set up dummy pages, is there anything I can do?

  • Set a custom 404 message at redirectedsite.com that isn't a 404 at all, but is a redirect to the new home page. Voila.
  • Brilliant! Thanks RTD!
  • DO WE NOT ROOL?
  • Monkeyfilter: a custom 404 message at redirectedsite.com that isn't a 404 at all, but is a redirect to the new home page.
  • Yeah, yous rules. I *do* still have to ask the new website people to redo their 404, but that's a hell of a lot better than asking them to create 427 dummy pages with redirects on them!
  • what's this "we"?
  • You could also suggest that the target site configure their 404 page to do the redirect only if the domain in the HTTP_REFERER server variable is your domain. That way they won't have to mess with the regular behavior of their 404 page.
  • That's a good suggestion, Rembrandt. Thanks!
  • While we're on the subject, I've been instructed to remove from a website I inherited, whatever bit of code keeps you from being able to back out of it with the back button. Help, anyone?
  • Back buttons are browser-specific, and retain the URL of the last site visited. This kind of memory has nothing to do with the code of a given web site and everything to do with the memory settings of the browser. There is no practical way to disable the "back" function for a given web site. One possible, albeit lame workaround would be to force all comers to do a total refresh in the hope that they would clean out their recent history in doing so. I doubt it would work.
  • How complex is the site you inherited? It could be some badly coded frames doing it, or a redirect script that bounces you back as fast as you can hit the back button.
  • I think it is the redirect-script thingy. It's in PHP, which I know very little about.
  • If you set server level redirects - "301 redirects" - then the search engines will rejig their indexes for you, and the problem will disappear. You'll keep pagerank too. I prefer to do this by changing the .htaccess file If you access for that, then you can do all manner of clever redirects. If not here's all sorts of ways of doing it.
  • I think I'll do that, DIMMN, because the new 404 is only slightly better than a default 404. Thanks all for your help!