How to replace domain in?

Good evening!
Please tell me how to change domain in img all the pages where the domain is equal to site.my.ru on my-site.ru .

example:
<img src="http://site.my.ru/img.jpg">
on
<img src="http://my-site.ru/img.jpg">

Need a solution for js.
July 2nd 19 at 14:10
2 answers
July 2nd 19 at 14:12
To open the sql file in notepad++ and replace src="site.my.ru on src="my-site.ru
If this is for html pages to open all the pages in notepad and replace in all pages
Panel notepad++ Search>Find>Replace
And here sql and which file should I open? And the decision it is necessary on Js. But thanks for the reply. - Hal.Collier71 commented on July 2nd 19 at 14:15
I suggest you to open 700+ pages) - Hal.Collier71 commented on July 2nd 19 at 14:18
XS. Can htaccess/ as totak like
RewriteCond %{HTTP_HOST} ^(www\.)?site1\.ru^/([0-9]+)(.jpg/.png/.gif)*$
RewriteRule ^(.*)$ site2.ru/$1 [R=301,L] - Bernie commented on July 2nd 19 at 14:21
July 2nd 19 at 14:14
If you have a script connected to all pages, then
$('a[href^=http://site.my.ru]').each(el => {
 el.href = el.href.replace(/http:\/\/site.my.ru\/, 'http://my-site.ru');
});

Can I do this using bash
find . -name *.html -exec sed 's/http:\/\/site.my.ru/http:\/\/my-site.EN\/\/g' * {} \;
Thank You Dmitry. And your example in js not written for ? it just doesn't work with img. - Hal.Collier71 commented on July 2nd 19 at 14:17
"a" - Hal.Collier71 commented on July 2nd 19 at 14:20
: Yes, I wrote it in Jquery because the tags mentioned it. - Bernie commented on July 2nd 19 at 14:23

Find more questions by tags jQueryHTMLJavaScript