M
M
MtoSmart2016-02-24 01:51:15
CMS
MtoSmart, 2016-02-24 01:51:15

How to automatically change all image links on a WordPress site that has been moved from one domain to another?

У нас был сайт 1 который решили переместить на другой сервер и сделать сайт с другим видом 2.
Но при переносе все картинки ( из сайта 2 )до сих пор ( само собой) направлены ссылками на сайт 1. ( а сайт 1 мы собираемся уничтожать)

Вопрос:
Есть куча картинок разного размера на разных страницах, каким образом одновременно заменить все ссылки которые содержатся на новом Сайте и переадресовать на свой же сервер.?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sanes, 2016-02-24
@Sanes

Download the database and change it in a text editor (find/replace). The easiest way.

M
MtoSmart, 2016-02-24
@MtoSmart

and the problem is that the links were not created correctly.
Instead of calling them
wp/image.jpg
They go like:
website.com/wp/image.jpg
And we need to move them to :
all the pictures will be lost because the links will be broken)
In my opinion, the easiest way is to manually kill all the links with autocorrect, but as I understand it, it can break everything in WP.
What are the options for safely auto-replacing replacement links?

S
Super User, 2016-02-24
@sergeystepanov1988

There is such a plugin https://wordpress.org/plugins/wp-migrate-db/
There is a search and replace function. Replace links in the database and export the database. Then upload to the new site.
In general, look, there should be a lot of such plugins. You are not the first to face this problem.
UPD , Modifying the html output:

function my_callback($buffer) {
  // модифицируем $buffer здесь и возвращаем его
  return $buffer;
}

function my_buffer_start() { ob_start("my_callback"); }

function my_buffer_end() { ob_end_flush(); }

add_action('wp_loaded', 'my_buffer_start');
add_action('shutdown', 'my_buffer_end');

B
bro-dev, 2016-03-01
@xPomaHx

Well, I would just search and replace in the sublime. but this will only work if they are not in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question