R
R
rinaz222020-06-24 20:37:03
htaccess
rinaz22, 2020-06-24 20:37:03

How to change image upload path using htaccess?

Hello. There is a normal html code and a picture. This html file is located in the root (index.html). The img folder is here: files/img/ (i.e. 1 deeper than indicated in the code). Of course, the picture will not load, because. its full path is files/img/bg.jpg Question: Is it possible to change the path using htaccess or make a request to the files folder and upload an image from there. As a result, it should look like the image is loaded from the img root folder. I tried doing this, but it didn't help:
<img src="img/bg.jpg" alt="">

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* files/ [L]

This is just a rough example of what I want. It's just that I've been looking for an answer to my question for almost a week, but so far without a result.
Please don't write that you shouldn't be so smart, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-06-24
@rinaz22

RewriteCond %{DOCUMENT_ROOT}/files/$1 -f
RewriteRule ^(img/.+) /files/$1 [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question