Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Search and Replace Example...

Quote Reply
Search and Replace Example...
I'm interested in search and replacing part of a Link's URL. A bunch of Links are broken because the Link owner changed their URLs without providing forwarders. Anyways, I've search the forums and I've tracked down a few examples of how this is supposed to be done. However, I want to confirm this before I go ahead and make the changes to the database. Here is what I want to do,

http://www.example.ca/boardwiseii/Document.asp?DID=815

to

http://sso.example.ca/e-Library/Document.asp?DID=815

so following the instructions found in the forums, would this work?

Code:
UPDATE Links SET URL = REPLACE(URL, 'http://www.example.ca/boardwiseii/Document.asp', 'http://sso.example.ca/e-Library/Document.asp')


Code:

Quote Reply
Re: [mapleleafweb] Search and Replace Example... In reply to
You might want to make it:
Code:
UPDATE Links SET URL = REPLACE(URL, 'http://www.example.ca/boardwiseii/Document.asp', 'http://sso.example.ca/e-Library/Document.asp') WHERE URL LIKE 'http://www.example.ca/boardwiseii/Document.asp%'
Just in case MySQL isn't smart about its updating (so it doesn't unnecessarily update the link timestamps.

Edit: it is smart about it, but it's slightly faster to do it like that anyways.

Adrian

Last edited by:

brewt: Feb 12, 2007, 3:49 PM
Quote Reply
Re: [brewt] Search and Replace Example... In reply to
Ok, I'll give it a try,

after its completed, is there anything special I need to do other than rebuild?
Quote Reply
Re: [mapleleafweb] Search and Replace Example... In reply to
You might need to do a complete rebuild rather than a build changed since you've modified the database manually.

Adrian