Forum Moderators: phranque
Will any of the URLs for your content be changing in this migration? It is much better to keep the same URLs as before if you can.
There are many ways of achieving that.
If you cannot do so, it is vital that old URLs redirect to equivalent new URLs as soon as the new site goes live.
RewriteEngine On
RewriteBase /
# PUT THE AUTHORIZED ADMIN IP ADDRESSSES IN THE LINES BELOW
RewriteCond %{REMOTE_ADDR} ^111\.222\.333\.444$ [NC,OR]
RewriteCond %{REMOTE_ADDR} ^111\.222\.333\.444$ [NC]
# THE ACTUAL CODE YOU USE FOR THE REDIRECT HERE WILL HAVE TO BE
# A LOT MORE COMPLICATED, DEPENDING ON WHETHER THERE ARE
# QUERY STRINGS IN THE URLS, WHERE YOU REALLY WANT TO GO, AND
# HOW THE OLD URLS MAP TO NEW ONES (IF AT ALL).
RewriteRule .* http://example.com/adminpage.php [R=301,L]
It is very unlikely that you can do this successfully without understanding the code, so the above is not posted as copy-and-paste. The intent is that you take the keywords and do web searches on them (see the Apache documentation at [httpd.apache.org...] ). Expect to spend a couple of days on it.
If you want to do a redirect when the IP address does NOT match the list of admin IP's:
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$ [NC]
RewriteCond %{REMOTE_ADDR} !^444\.555\.666\.777$ [NC]
Note the added leading exclamation point, which means NOT.
This actually might be the form you'd end up using, based on your later comment that you want to redirect visitors (possibly to a static page that simply says, "Our website is down temporarily during a reorganization.") but allow yourself to work on the new site normally. This approach would be a lot easier. The following code is mostly copy-and-paste code to address that situation. It redirects all your visitors to sitedown.html, which you must create, saying the site is temporarily down.
#RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$
#RewriteCond %{REMOTE_ADDR} !^555\.666\.777\.888$
#RewriteCond %{REQUEST_URI} !^/sitedown.html$
#RewriteRule ^(.*)$ /sitedown.html [L]
There are other more complicated ways to handle this, as well, such as using a 503 error message, which is a more search engine friendly way to do it. However, since your reorganization is going to confuse search engines when it occurs, anyway, it may not be worth the trouble.
When you do the switchover, if you don't find a way to map old URLs to new ones, your site pages will lose all their search engine ranking status. The new pages will have to earn PageRank from scratch.
[edited by: SteveWh at 6:41 pm (utc) on Oct. 13, 2008]