0

I am trying to replace lots of pages in my database at once, and lots of pages that are indexed by Google will have new URLs. So in result, old pages will be redirected to a 404 page.

So I need to design a new 404 page, by including a search box in it. Also, I want the 404 page to grab the keywords in the broken URL in the address bar, and show the search result based on the keywords in the broken links, so that user will have an idea where to go next to the new link.

Old URL:

http://abc.com/123-good-books-on-rails

New URL:

http://abc.com/good-books-on-rails

Then when a user comes from search engine, it shows the old URL. The 404 page will do a search on "good books on rails" keywords and return with a list of search result. So the user know the latest url of that link.

How do I implement this? I will be using Friendly ID, Sphinx and Rails 2.3.8.

Thanks.

Victor
  • 13,010
  • 18
  • 83
  • 146

1 Answers1

2

You are far better off simply generating the appropriate redirects yourself than to expect your users to do anything weird if a Google link fails. This won't be indefinite - Google will eventually reindex you. If you use 301 (permanent) redirects, Google will be smart enough to NOT follow the link when reindexing your site. If you don't want to manually create redirects for hundreds of pages, then you'll need to try to figure out the algorithm for how your old pages map to new pages.

Marc Talbot
  • 2,059
  • 2
  • 21
  • 27
  • +1: 301 should be easier to implement, and is also the *correct* way to move resources using HTTP. – Andrew Apr 03 '11 at 13:42
  • If I wanna take up your advice, will it be easier for me to have a column called "new links", and not delete the old pages, but put in the new url in the "new links" column, then use META redirect? It's easier for me to implement this. Any better approach? Thanks. – Victor Apr 03 '11 at 14:42