View Full Version : Replace old URL with new URL from entire Database
David_R
03-07-2005, 05:49 AM
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:
UPDATE post SET pagetext = REPLACE(pagetext,'www.olddomain.com','www.newdomai n.com')
For pm's this SQL query:
UPDATE pmtext SET message = REPLACE(message,'www.olddomain.com','www.newdomain .com')
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.
Dean C
03-07-2005, 03:02 PM
Oh wow, I never knew about that MySQL function :)
David_R
03-08-2005, 04:48 AM
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.
UPDATE post SET pagetext = REPLACE(pagetext,'www.olddomain.com','www.newdomai n.com') This will replace www.olddomain.com with 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:
UPDATE post SET pagetext = REPLACE(pagetext,'olddomain.com','newdomain.com') ?
Guy G
03-08-2005, 12:02 PM
REPLACE(message,'www.olddomain.com','www.newdomain .com')
only that line needs to be changed.
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.
David_R
03-09-2005, 04:09 PM
will this work properly for hyperlinks too ?
Marco van Herwaarden
03-09-2005, 05:29 PM
It will run on any text.
David_R
04-03-2005, 03:57 AM
Run this SQL query:
UPDATE post SET pagetext = REPLACE(pagetext,'www.olddomain.com','www.newdomai n.com')
For pm's this SQL query:
UPDATE pmtext SET message = REPLACE(message,'www.olddomain.com','www.newdomain .com')
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.
Posts and PMs Changed properly Thanks :)
Can you also list some more queries to change Signatures too :)
Changing homepage set under profile, and text content in the signatures
Guy G
04-03-2005, 09:57 AM
Signatures
UPDATE usertextfield SET signature = REPLACE(signature,'www.olddomain.com','www.newdoma in.com')
Homepage
UPDATE user SET homepage = REPLACE(homepage,'www.olddomain.com','www.newdomai n.com')
Reeve of shinra
04-03-2005, 06:28 PM
wouldnt it be easier to use vb's replace feature.
santamia
12-07-2011, 12:59 PM
I change domain for my website now is www.mamicamea.ro/forum/ old domain was www.sarcina-nasterea.ro/
For last version of vbulletin and mysql with Apache/2.2.21 is same code?
Scyther
03-30-2012, 08:45 AM
wouldnt it be easier to use vb's replace feature.
what is this vb replace feature?
how to do it?
Simon Lloyd
04-02-2012, 08:57 AM
what is this vb replace feature?
how to do it?It's for find and replace in vBulletin templates found in admincp here http://www.YOURSITE.com/forum/admincp/template.php?do=search
Scyther
04-03-2012, 04:40 AM
I am facing similar situation here.
I am trying to add my old forum's database to the new forum, but when i add it and try to access the site, it redirects to the old domain and not the new one!!!
How do i fix this?
The old domain is not with me anymore, hence i can't update it via Admincp as well..!
Simon Lloyd
04-03-2012, 11:28 AM
Copy the database over and change all instances of the domain name (2 places i think). Try the 'setting' table (bbburl varname) and search for bburl in the 'datastore' table also and change the first URL after that in the text.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.