![]() |
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.
|
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? |
Quote:
how to do it? |
Quote:
|
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..! |
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.
|
All times are GMT. The time now is 05:22 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:
|