A
A
Alexey Konovalov2020-04-16 16:27:04
PHP
Alexey Konovalov, 2020-04-16 16:27:04

How to display images on a test site if they are on the main site?

Hello! All images on the site are connected like this: I transferred the site files (except images, because there are hundreds of thousands of them) to a test hosting. Of course, the images inserted on the page are not displayed, because the path is relative. Is it possible, without changing the output of links to images, to make it clear to the test server that images should be taken from the main one? <img src="/uploads/news/123.jpg">

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2020-04-16
@Alk90

you can set up a redirect in oppache, Redirect /uploads http://main.site/uploads
but I would just transfer the pictures to the test one.

T
TostPOST, 2020-04-16
@TostPOST

Well, if these are different domains, then you can write the absolute path to those images, for example, instead of "/uploads/news/123.jpg" - " https://example.com/uploads/news/123.jpg ", that's the only way. If the sites are different, then their file system is not the same, and in general they are located on different servers, that is, there is no way to use a relative address, but in general it is better to always use an absolute url.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question