I’m managing an established site which is currently in the process of being upgraded (completely replaced anew), but I’m worried that I’ll lose all my Google indexing (that is, there will be a lot of pages in Google’s index which won’t exist in that place any more).
The last time I upgraded a (different) site, someone told me I should have done something so that my SEO isn’t adversely affected. The problem is, I can’t remember what that something was.
Update for some clarification: Basically I’m looking for some way to map the old paths to the new ones. For example:
- User searches for ‘awesome page’
- Google returns
mysite.com/old_awesome_page.php, user clicks it. - My site takes them to
mysite.com/new_awesome_page.php
And when Google gets around to crawling the site again…
- Google crawls my site, refreshing the existing indexes.
- Requests
old_awesome_page.php - My site tells Google that the page has now moved to
new_awesome_page.php.
There won’t be a simple 1:1 mapping like that, it’ll be more like (old) index.php?page=awesome --> (new) index.php/pages/awesome, so I can’t just replace the contents of the existing files with redirects.
I’m using PHP on Apache
You need to put some rewrite rules in an .htaccess file.
You can find lots of good information here. It’s for Apache 1.3, but it works for Apache 2, too.
From that article, a sample for redirecting to files that have moved directories:
This reads:
There are additional directives that you can use to set a [301] redirect
You could do:
But you’d have to have a rule for every page. To avoid this, I’d look at using Regular Expressions, as in the first example.