modify the links for another domain name

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
User avatar
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

janus_zonstraal wrote: Mon Jan 16, 2023 8:17 am
copy and paste the code run the query
After running the query you will get a message, can you post the message here?
Screenshot_20230116_232259_Chrome.jpg
Screenshot_20230116_090444_Chrome.jpg
Screenshot_20230116_232145_Chrome.jpg
Salutations à la communauté phpBB
User avatar
janus_zonstraal
Registered User
Posts: 6418
Joined: Sat Aug 30, 2014 1:30 pm

Re: modify the links for another domain name

Post by janus_zonstraal »

See last image "zero lines affected".
So your code is incorrect.
Sorry! My English is bat ;) !!!
User avatar
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

do i have to select all tables from phpbb_post then run the code?
Salutations à la communauté phpBB
User avatar
warmweer
Jr. Extension Validator
Posts: 11235
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: modify the links for another domain name

Post by warmweer »

I see no semi-colon at the end of the SQL
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
warmweer
Jr. Extension Validator
Posts: 11235
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: modify the links for another domain name

Post by warmweer »

hamidouki wrote: Mon Jan 16, 2023 10:45 pm do i have to select all tables from phpbb_post then run the code?
phpbb_posts is the table
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
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

warmweer wrote: Mon Jan 16, 2023 10:57 pm
hamidouki wrote: Mon Jan 16, 2023 10:45 pm do i have to select all tables from phpbb_post then run the code?
phpbb_posts is the table
so do I have an error or is it not the case to change all the links in the subjects which point to my new domain name?
Salutations à la communauté phpBB
User avatar
warmweer
Jr. Extension Validator
Posts: 11235
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: modify the links for another domain name

Post by warmweer »

Code: Select all

UPDATE `phpbb_posts` SET `post_text` = REPLACE (post_text, 'something', 'something_else');
note the difference between ` and '

hamidouki wrote: Mon Jan 16, 2023 11:02 pm so do I have an error or is it not the case to change all the links in the subjects which point to my new domain name?
I'm not sure what you mean with that: subjects?
From what I gather, you've got post_text containing http:// and you want to replace that with https://.
I wouldn't check for http:// only as there might be other links using that (and you don't want to replace those)
let it look for http://mydomainname in different forms (with and without the www.)

As always, test this on a copy of the table first (I can't vouch for my typing skills - nor for my sql skills.)
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
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

no not at all.
I want to change www.mydomainename1.com by www.mydomainename2.com on my topic and subjects of the new forum www.mydomaibename2.com
Salutations à la communauté phpBB
User avatar
warmweer
Jr. Extension Validator
Posts: 11235
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: modify the links for another domain name

Post by warmweer »

hamidouki wrote: Tue Jan 17, 2023 12:23 am no not at all.
I want to change www.mydomainename1.com by www.mydomainename2.com on my topic and subjects of the new forum www.mydomaibename2.com
Assuming you want to change the content of the posts (that's what you're trying with your SQL), then the SQL I posted should work.
If that's not what you intend, you'll need to explain exactly what you mean with topic and subjects ("subject" is not a phpBB-architecture term). From what I understand you only need to edit the posts_table
Did you try my SQL? (just in case: the SQL is case sensitive: In my SQL "something" will be changed, but not "Something"
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
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

instead of having this:
https://www.mydomaine1/viewtopic.php?p= ... #p15920166
I want to automatically change it to the new domain:
https://www.mydomaine2/viewtopic.php?p= ... #p15920166
Screenshot_20230117_085757_Chrome.jpg
For all topic in the forum
Salutations à la communauté phpBB
User avatar
warmweer
Jr. Extension Validator
Posts: 11235
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: modify the links for another domain name

Post by warmweer »

I take it you've tried the SQL I proposed.
What 's the result?
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
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

Code: Select all

Erreur lors du démarrage de la session ; veuillez vérifier votre fichier journal PHP et/ou votre serveur Web et configurer correctement votre installation PHP. Assurez-vous également que les cookies sont activés dans votre navigateur.

session_start() : échec de l'ouverture (SESSION_FILE, O_RDWR) : quota de disque dépassé (122)

session_start() : échec de la lecture des données de session : fichiers (chemin : /home/powers76/tmp)
I have erreur when I open my phpadmin
And for my restore DDB I have this message
Screenshot_20230118_001536_Chrome.jpg
Salutations à la communauté phpBB
User avatar
warmweer
Jr. Extension Validator
Posts: 11235
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: modify the links for another domain name

Post by warmweer »

hamidouki wrote: Tue Jan 17, 2023 11:12 pm

Code: Select all

Erreur lors du démarrage de la session ; veuillez vérifier votre fichier journal PHP et/ou votre serveur Web et configurer correctement votre installation PHP. Assurez-vous également que les cookies sont activés dans votre navigateur.

session_start() : échec de l'ouverture (SESSION_FILE, O_RDWR) : quota de disque dépassé (122)

session_start() : échec de la lecture des données de session : fichiers (chemin : /home/powers76/tmp)
I have erreur when I open my phpadmin
That's something you'll have to take up with your webhost.

BTW, another way to achieve want you want , is to backup and download the posts_table, open the posts_table.sql in Notepad+ (or similar, capable of opening and editing large files) and do the edits using the texteditor (search and replace). Save, upload and restore the edited table.
Take into account that you're board should be disabled before you download the posts_table, and only re-enabled after you've restored the edited version.
If you leave your board enabled, new topics and posts could have been made and you'll lose data.
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
hamidouki
Registered User
Posts: 344
Joined: Sun Aug 02, 2015 2:33 pm

Re: modify the links for another domain name

Post by hamidouki »

Topic solved
UPDATE phpbb_posts SET post_text = REPLACE(post_text, 'www.yourdomaine1.com', 'www.yourdomaine2.com') WHERE post_text LIKE '%www.yourdomaine1.com%';
By SSL
Thanks
Salutations à la communauté phpBB
Post Reply

Return to “phpBB Custom Coding”