How to display image on the test site if they are on the primary?

Hello! All images on the website are connected like so: <img src="/uploads/news/123.jpg">
I moved the site files (except images, because hundreds of thousands of them) on a test hosting. Of course inserted on the page the images are not displayed because the path is relative.
Is there a possibility without changing the output of the image links, to make it clear to a test server, that image must be taken with osnovnogo?
April 19th 20 at 12:20
2 answers
April 19th 20 at 12:22
Solution
it is possible to establish Apache redirect in, Redirect /uploads http://main.site/uploads
but I just moved the pictures to the test.
April 19th 20 at 12:24
Well, if they are different domains, you can register the absolute path to the images, for example, instead of "/uploads/news/123.jpg" - "https://example.com/uploads/news/123.jpg"the only way. If the sites are different, hence the file system they are not one and the same, and generally they are on different servers, that is the relative address to use in any way, but it is always the absolute url to use.
he already absolute
but to write domain - this is nonsense.
then the statics will be leaving to another server and all links to rewrite - ottilie51 commented on April 19th 20 at 12:27
@ottilie51, <img src="/uploads/news/123.jpg"> this is a relative.

But I maintain that absolute write is bad. - Andres41 commented on April 19th 20 at 12:30
It absoltly path, it starts from / - ottilie51 commented on April 19th 20 at 12:33
@ottilie51, an absolute path works from any place where he is not written and begins with a Protocol or / / if it is unknown.

A path beginning with / is a path relative to the site root. And because it is relative, not absolute, and it does not work when you migrate links or file path (in this case image) to another domain. - Andres41 commented on April 19th 20 at 12:36
it is not necessary putti url - ottilie51 commented on April 19th 20 at 12:39
@ottilie51, In that case, if the images are on another server - relative path will not work - bori commented on April 19th 20 at 12:42

Find more questions by tags HTMLPHP