SetiroN
SetiroN

Reputation: 1

Replacing beginning and end of multiple URLs in mysql

I'm in the process of converting my wordpress website to https, and the issue I have is that a bunch of pages have external embeds that require a different url for https.

So I need to replace: http://online.anyflip.com/code1/code2/ with: https://s3.amazonaws.com/code1/code2/index.html

where code1 and code2 are different for each url.

So something like:

UPDATE wpe_posts 
SET    post_content = ( Replace (post_content, 'src="http://online.anyflip.com/$code1$/$code2$/', 'src="https://s3.amazonaws.com/online.anyflip.com/$code1$/$code2$/index.html') )

That isn't this obviously wrong.

Any help would be much appreciated.

Upvotes: 0

Views: 128

Answers (1)

Srinivasan Rajasekaran
Srinivasan Rajasekaran

Reputation: 585

Try this,

Instead of replacing Entire String just replace the part after src,

SET    post_content = ( Replace (post_content, 'http://online.anyflip.com/$code1$/$code2$/', 'https://s3.amazonaws.com/online.anyflip.com/$code1$/$code2$/index.html') )

Upvotes: 2

Related Questions