![]() |
Replace old URL with new URL from entire Database
Hi,
We recently changed our forums url from www.olddomain.com to www.newdomain.com We are using olddomain.com for more then 2 years and there are lots of posts, pms, internallly which contain those urls. Is there a way to replace this from entire database ? I know this can be done manually downloading the entire 800 MB database and removing those entries manually. I am looking for an automated procedure. we have following urls to be replace. www.oldomain.com olddomain.com www.olddomain.com/forum forum.olddomain.com thank you. |
Run this SQL query:
[sql]UPDATE post SET pagetext = REPLACE(pagetext,'www.olddomain.com','www.newdomai n.com')[/sql] For pm's this SQL query: [sql]UPDATE pmtext SET message = REPLACE(message,'www.olddomain.com','www.newdomain .com')[/sql] Note that query is very intensive, you should back-up your db before using it. It may very well screw up a lot of your posts/pms/entire database. Remember to re-build the postcache if you use it, or the changes will not apper right away. |
Oh wow, I never knew about that MySQL function :)
|
thankyou very much for posting the easy solution here.
some questions. Text to be replaced was our olddomain name, it used extensively across the database. In code tags, html tags, php tags, signatures, posts, pms, notes, every possible end-user area, As suggested by you. Code:
UPDATE post SET pagetext = REPLACE(pagetext,'www.olddomain.com','www.newdomain.com') To execute other replacements: olddomain.com www.olddomain.com/forum forum.olddomain.com I assume I will only need to run 1 additional line: Code:
UPDATE post SET pagetext = REPLACE(pagetext,'olddomain.com','newdomain.com') |
Quote:
this: "www.olddomain.com" is what u are looking for in the database and this: "www.newdomain.com" is what being replaced.... change those to whatever u need. |
will this work properly for hyperlinks too ?
|
It will run on any text.
|
Quote:
Can you also list some more queries to change Signatures too :) Changing homepage set under profile, and text content in the signatures |
Signatures
[sql] UPDATE usertextfield SET signature = REPLACE(signature,'www.olddomain.com','www.newdoma in.com') [/sql] Homepage [sql] UPDATE user SET homepage = REPLACE(homepage,'www.olddomain.com','www.newdomai n.com') [/sql] |
wouldnt it be easier to use vb's replace feature.
|
All times are GMT. The time now is 10:54 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|