Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-08-26 10:29:09

jfp
Member
From: Clamart, France
Registered: 2004-04-02
Posts: 21
Website

Global change of URL for images for existing posts?

Hi,
by default Textpattern provide a complete url for images added to any post. Since 2004, I applied directly this method:

http://website.com/images/xxx.jpg

But I have recently moved my textpattern install

from
http://website.com
to
http://new.website.com

So, how to update all images url globally from http://website.com/images/xxx.jpg to http://new.website.com/images/xxx.jpg or /images/xxx.jpg without opening one by one 700 entries?

Thanks in advance for your help,

Edit by gaekwad: fixed Textile.

Last edited by gaekwad (2020-08-26 15:27:52)

Offline

#2 2020-08-26 14:23:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,269
Website

Re: Global change of URL for images for existing posts?

It depends how you were calling the images. Were you using the txp:image or txp:images tags?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#3 2020-08-27 06:19:51

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,933
Website

Re: Global change of URL for images for existing posts?

jfp wrote #325572:

Hi,
by default Textpattern provide a complete url for images added to any post. Since 2004, I applied directly this method:

http://website.com/images/xxx.jpg

But I have recently moved my textpattern install

from
http://website.com
to
http://new.website.com

So, how to update all images url globally from http://website.com/images/xxx.jpg to http://new.website.com/images/xxx.jpg or /images/xxx.jpg without opening one by one 700 entries?

Thanks in advance for your help,

Edit by gaekwad: fixed Textile.

Hi jfp,

If you mean you‘ve been using the textile notation, i.e. !http://site.com/images/1.jpg! then you‘ll need to do a mass search and replace in the database.

See MySQL‘s REPLACE function.

You can run that in phpMyAdmin or another db editor such as Sequel Pro (Mac) in the SQL tab.

Note that you‘ll need to perform the search and replace on the Body and Body_html fields to see the results as Body_html holds the textile pre-rendered as HTML. The same goes for Excerpt and Excerpt_html if you have used images there.

Take a backup of your database first in case you need to start over.

BTW: you‘re more flexible In future if you rename to /images….


TXP Builders – finely-crafted code, design and txp

Offline

#4 2020-08-27 11:35:37

etc
Developer
Registered: 2010-11-11
Posts: 3,855
Website

Re: Global change of URL for images for existing posts?

Couldn’t some rewrite rule be in order here?

Offline

Board footer

Powered by FluxBB