Answer the question
In order to leave comments, you need to log in
How to replace non-existent images using htaccess?
Good afternoon,
there is a demo version of the project on the local. The production version is actively filled in by the client on the Internet.
The database is periodically backed up, which leads to changes in elements and paths to their images. Naturally, I don’t send a folder with images to the repository, as a result I get a bunch of 403 errors, for example, on a page with a list of news.
The project works on 1C-Bitrix.
I think as an option in the local htaccess write something like:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule upload/(.*)$ http://myProdSite.ru/upload/$1 [R=302,L,NC]
# другие правила bx
Answer the question
In order to leave comments, you need to log in
First of all, with this line, you clearly say that your regular expression is not for the file.
Try
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/upload/(.*)$
RewriteRule ^(.*)$ http://myProdSite.ru/upload/$1 [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question