Friends, faced with such a task. There are 1. Local site on OpenServer (on Windows Server) - location path \ server1 \ site1. The site is hosted on Drupal 7 2. The file storage (hard drive with network card) is the location path \ server2 \ 3. The library of books attached to site 1 is located at - \ server1 \ site1 \ files \
It is necessary - in general, to transfer the library of books from the address \ server1 \ site1 \ files \ to the address \ server2 \ so that
What was done At the root of the site in the file htaccess indicated such directives
Options +Indexes +FollowSymLinks RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^http://server1/site1/files (.*)$ http://server2 /$1 [L] AddDefaultCharset utf-8 AddType application/octet-stream .pdf What is the problem - when redirecting, the server gives an error - Server / file.pdf - not found. If you add to the path file: //, getting
file: // Server / file.pdf, the file is read. Okay. Now if the line
RewriteRule ^http://server1/site1/files (.*)$ http://server2 /$1 [L], переписать так RewriteRule ^http://server1/site1/files (.*)$ file://server2 /$1 [L], то сайт 1. Do not redirect to the address - file: // server2 / $ 1 2. They will issue an access error - Access forbidden! It is either read-protected or not readable by the server. 403 error
The question arises How to make the correct redirect for any file from the address \ server1 \ site1 \ files \ file.pdf 'to address - \ server2 \ file.pdf