views:

62

answers:

4

Hi,

I created a rails app for my client. It was PHP and I totally rebuild it from the scratch with rails. The problem is that the site is old and many old pages are ranked in google. Naturally many people will click the page link in google and the page won't be available.

How do you usually handle such a problem?

I need to redirect such requests (missing old pages) to the main front page of the new app(rails). How can I do that?

Thanks.

Sam

A: 

You might google ".htaccess", apache and "permanent redirect".

John Lockwood
+1  A: 

A 301 redirect is meant to be the most efficient and Google friendly way and should preserve your search page ranking.

That said, I haven't tried it in real-life as the next release of my application will be using this approach to restructure a web site.

Dave Barker
A: 

If you have been able to maintain the URLs in the new application(eg /members.php is now /members), you can do the following if you use apache:

  RewriteRule ^(.*).php $1 [R=301,L]

This will remove the php extension and do a 301 redirect, and should transfer the pagerank to the new page.

If this is not possible and you must redirect to the new main page this MIGHT work, I have not tried it myself:

RewriteRule ^(.*).php http://www.example.com/ [R=301,L]
Roger Ertesvag
A: 

Redirecting the user to the front-page would be kind of disorienting without a note (flash[:notice]) to let him know what went wrong.

I think it would be better to write some routes in config/routes.rb to handle the old pages and return the new versions of the pages (if they still exist) else fallback to a 404 page.

vrinek