logo

Redirecting Users After Moving a Database

I thought I'd share this tip as I just used it for the second time, so maybe you will one day.

Imagine you need to move a Domino database and its content to a different server. Chances are that the web address will change.

Let's say this database:

https://server1.acme.com/database.nsf/

is moving to this new address:

https://server2.acme.com/database.nsf/

How do you let users know? Do you setup URL Rewrite documents in the Domino Directory to auto-rewrite or redirect them as they come in? You could do, but an alternative is to simply display a page telling them it's moved, why it moved and that they should update their bookmarks accordingly.

You can then display a link for them to click to go to where they need to be. This tip describes a simple way to do that.

First, follow these steps:

  1. Copy the database to its new location.
  2. Delete all documents from the old database.
  3. Remove all Forms, Views etc from old database.
  4. Create a new Form called $$ReturnGeneralError in the old database.

It's this $$ReturnGeneralError form which does the magic:

image

Whenever a user visits any URL at the old address we can now show them a link to where they should be. The formula for the Computed Value you can see above is as follows:

oldSubDomain:= "server1";
newSubDomain:= "server2";
link:= "http"+@If(HTTPS="ON"; "s"; "") + "://" +
        @ReplaceSubstring(@LowerCase(Server_Name); oldSubDomain; newSubDomain) +
        @LowerCase(Path_Info);
        
"<a href=\""+link+"\">"+link+"</a>"

The beauty of this trick is that it should work for absolutely any working Domino URL from the old database. including all of the following:

  • http://server1.acme.com/database.nsf/0/BC577A02327A584D8025778B00707230?Open
  • http://server1.acme.com/database.nsf/contacts?OpenView
  • http://server1.acme.com/database.nsf/pages/about

Because they will all be classed as 404/Errors the same form will be used to display the new location's link to the user. Simples!

This has also worked for me in the past when I've merged the content of one database with another. In that case rather than doing a replacement on the Server_Name field I did a replacement of the Path_Info string to update the file path to the new database.

SEO

When the web spiders next come crawling to index the old site they will get a lot of 404s. As I understand it, after a while it will stop indexing that content and forget it ever existed. Because we're providing the spider with a new working URL they should then index that instead. I know there are HTTP status codes (301) for doing this, but this done the same thing in a round-about fashion.

Comments

  1. "As I understand it, after a while it will stop indexing that content and forget it ever existed."

    No they don't. I am still getting hit for content which was removed/moved 8 years ago. Baidu, Googlebot and a slew of others still visit regularly and generate a shed load of error reports in my stats. I have tried 301, 302, 404, even 401 to get them to sod off. In the end I tried putting blank content on some pages with noindex/nofollow and it still does no good.

    It seems that once the content is there bots assume it'll always be there ad infinitum.

    1. You can stop the spiders from crawling your pages by adding a robots.txt-file in the <Notes Data>\domino\html\ folder.

      Show the rest of this thread

    • avatar
    • Ferdy
    • Thu 9 Feb 2012 09:18 AM

    Jake,

    Great tip, but I'd like to add that preferably one does not hand out production URLs that have a machine/hostname in the URL. By using a "friendly" hostname, moving a site is a matter of changing the DNS, and all your SEO value will remain the same. Ideally you wouldn't even include a file path in the URL, but that's harder to accomplish.

    1. Another way is to use Web Site Rules in the Global Web Settings and use substitutions and/or redirects to accomplish this.

    2. Agreed Ferdy. My example was poorly thought through. In my real world scenario the subdomain wasn't machine-name-based, but role-based. A better example might have been to move a database from sales.acme.com to marketing.acme.com.

    • avatar
    • Palmi
    • Thu 9 Feb 2012 01:48 PM

    I aggree with Sven , its better then do a "hack" coding.

    1. Normally I'd agree, but it's not always the best technical solution that wins. Sometimes there's an over-riding business reason not to. For example, the "corporate message" that needs to be conveyed as the reason for the move.

  2. Very creative solution!

    Fredrik

    • avatar
    • anil
    • Wed 1 Aug 2012 08:23 PM

    What is URL REDIRECTION?How can i use this concept in my .net?

    my task is i have generated one url like this "http://example.com/"

    I am passing one pearameter like "http://example.com/Empno=1"

    I want to display Ename in Database table that corresponding "Empno"

    plz Help me Give me one simple example

    I am new this concepts

    plz Help me send source code to my mailID:mandla.anilbabu@gmail.com

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Thu 9 Feb 2012

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content