Answer the question
In order to leave comments, you need to log in
How to redirect requests via htaccess?
Hello comrades! Please tell me how to redirect requests from one host to another.
The point is that when requesting images from the site site.ru/myimg.jpg, the image is actually loaded from here img.site.ru/myimg.jpg
I try to do this, it doesn’t work ((
RewriteCond ^(.*)\.(jpg|jpeg|gif|png)$ [NC]
RewriteRule https://img.site.ru%{REQUEST_URI}$ [L]
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ https://img.site.ru/$1 [R=301,L]
#RewriteCond %{REQUEST_URI} uploads/.*
#RewriteRule (.*) https://img.site.ru/$1 [QSA,L]
Answer the question
In order to leave comments, you need to log in
images are not url but href to site model home, and redirect doesn't work in it, you need to change these links on the site itself
Or use php proxy
or ninx proxy - it will be more correct for statics.
you can use mod_proxy for apache - but that's crazy.
And it will be even easier not to create game a la 90s, and give pictures from the same urls and proxy them to balancing servers through nginx like normal people.
Give more introductory, why do you need this action.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question