I have a number of EE rich text fields for a bunch of entries with inline images that have been uploaded. I'm noticing that the HTML image tags this generates is including the full, absolute image URL with a domain, e.g. http://www.cool.pizza/assets/img/etc.jpg instead of just /assets/img/etc.jpg. We are switching subdomains soon, however. Is there any way to do a mass text replace on these fields to remove the "http://www.cool.pizza" from image URLs?

2 Answers 2


There's a tool for this kind of task on the Control Panel -> Tools -> Data -> Search and Replace.

Just look for http://www.cool.pizza/assets/img/ and replace it by /assets/img/.


MySQL to the rescue!!

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');

You need to use this command to do exactly what you want. You're will look like this (this is an example, DON'T RUN THIS COMMAND):

UPDATE channel_data SET field_id_25 = replace(field_id_25, 'bad_url.com', 'good_url.com');

It might be the channel_entries table that has the data, I can't remember. Also, you need to figure out which field your's is, it's not going to be field_id_25. As always, you must back up this database table before you try anything, or you'll be sorry. But this will do a complete find and replace on your field's column. To figure what your field ID is, you need to go to your channel field's field group. You'll find the field ID on this page:

Your site -> CP Home -> Administration -> Channel Fields -> Group: Your Field Group

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.