How to bulk change links in posts after moving a forum

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
Raziel-CZ
Registered User
Posts: 2
Joined: Tue Feb 15, 2022 8:20 am

How to bulk change links in posts after moving a forum

Post by Raziel-CZ »

I greet everyone and especially the support.

How do you change links in bulk posts after moving a forum from one domain to another (eg from forum.sebesdileni.cz to forum.etiq.cz)? Through some plugin or in phpMyAdmin?
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26825
Joined: Fri Aug 29, 2008 9:49 am

Re: How to bulk change links in posts after moving a forum

Post by Mick »

Welcome to phpBB

Please do not multi post the same topic, you're just making work for the moderators, thanks.
  • "The more connected we get the more alone we become” - Kyle Broflovski© 🇬🇧
User avatar
warmweer
Jr. Extension Validator
Posts: 11645
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: How to bulk change links in posts after moving a forum

Post by warmweer »

Raziel-CZ wrote: Tue Feb 15, 2022 8:22 am How do you change links in bulk posts after moving a forum from one domain to another (eg from forum.sebesdileni.cz to forum.etiq.cz)? Through some plugin or in phpMyAdmin?
Do a search and replace with phpMyAdmin (or similar) directly in the database (probably posts_table)
or (safer)
Do a search and replace (with Notepad+ or similar) on a database backup (freshly made) and when you're satisfied restore that altered database (you probably only need the posts_table) and disable your board while you working on it.

Whichever you choose, make sure you have a database backup in case something goes wrong.

BTW using the search function in this forum will point you to various topics with examples.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
Steve
Registered User
Posts: 1493
Joined: Tue Apr 07, 2009 7:48 pm
Name: Steven Clark

Re: How to bulk change links in posts after moving a forum

Post by Steve »

You could use : https://www.php.net/manual/en/function.preg-replace.php

Matching the old domain and sub domain, using a regex …

Using an event phpBB provides in viewtopic etc, you could write an extension …

Regards.

//edit
If you have access to the old server, you could use the apache mod rewrite rule.
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺

No: https://phpbb3bbcodes.com/viewforum.php?f=66 [r=66]Steve[/r=66]
Raziel-CZ
Registered User
Posts: 2
Joined: Tue Feb 15, 2022 8:20 am

Re: How to bulk change links in posts after moving a forum

Post by Raziel-CZ »

Additionally, thanks for the answers.

Mick for an off-topic answer without relevant advice such as a link and warmweer for a relevant answer that helped me. And Steeve, I'm just a bit of an advanced user, not a coder, so this advice didn't help me.

Have a nice day everyone.
User avatar
Steve
Registered User
Posts: 1493
Joined: Tue Apr 07, 2009 7:48 pm
Name: Steven Clark

Re: How to bulk change links in posts after moving a forum

Post by Steve »

I'm sure you will get help.
As for the textarea bug placing my smilies at the 1st position / position will have been reported to the team 🤣
Bug bug bug 🤣
Half hour later. Text box hello. What a crap box.
You do not have the required permissions to view the files attached to this post.
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺

No: https://phpbb3bbcodes.com/viewforum.php?f=66 [r=66]Steve[/r=66]
HB
Registered User
Posts: 229
Joined: Mon May 16, 2005 9:30 pm

Re: How to bulk change links in posts after moving a forum

Post by HB »

Raziel-CZ wrote: Sat Apr 13, 2024 5:16 pm...I'm just a bit of an advanced user, not a coder, so this advice didn't help me.
Assuming you have MySQL/mariadb access, here's the SQL:

Code: Select all

UPDATE phpbb3_posts set post_text = REPLACE(post_text, 'forum.sebesdileni.cz', 'forum.etiq.cz') WHERE post_text LIKE '%forum.sebesdileni.cz%';
This is a global replacement, but it's low risk IF the replacement is very unique, as is the case for "forum.sebesdileni.cz". Either way, I would test on a local installation and backup your database before making global changes like this.
Dan Kehn

Return to “[3.3.x] Support Forum”