vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Replace old URL with new URL from entire Database (https://vborg.vbsupport.ru/showthread.php?t=77648)

David_R 03-07-2005 05:49 AM

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.

Brad 03-07-2005 09:52 AM

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.

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.
Code:

UPDATE post SET pagetext = REPLACE(pagetext,'www.olddomain.com','www.newdomain.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:
Code:

UPDATE post SET pagetext = REPLACE(pagetext,'olddomain.com','newdomain.com')
?

Guy G 03-08-2005 12:02 PM

Quote:

Originally Posted by David_R
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

Quote:

Originally Posted by Brad.loo
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.

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
[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]

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

Quote:

Originally Posted by Reeve of shinra (Post 635414)
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

Quote:

Originally Posted by Scyther (Post 2314951)
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/adminc....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.


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
  • Page Generation 0.01156 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete