1

I am in the process of completing a transition from my client's old sites to a Drupal installation with multiple sites (this is my first experience with Drupal). Some of their older migrated content contains links to files available for download, which were previously located at an address in a format like firstsite.com/files/foo.zip.

They are insistent that these links not be changed, but since all of their sites are now in the same installation and there is overlap between file names (multiple sites may have a foo.zip to download), they cannot simply put all of their files in a /files subdirectory of the root (as these links would deliver a visitor to).

Is there a way I could deliver incoming requests for /files to the public files directory of each site? For example, if firstsite.com/files/foo.zip is requested, take them to /sites/firstsite.com/files/foo.zip?

I have attempted using .htaccess matched redirects but these apply universally and I cannot seem to capture the part of the request that precedes /files/foo.zip, and am not familiar enough with RewriteCond/RewriteRule pairs to build a working set for each site. Does Drupal have inbuilt functionality for this kind of legacy adaptation, or are there specific .htaccess rules that are suited to this procedure?

0

If you used a drupal multi-site installation for the various websites. Then each site may have it's own dedicated Files directory which may be set in Admin -> Media -> File System per subsite.

| improve this answer | |
0

.htaccess is the way to go, add this to your rewrite section for every domain you need:

RewriteCond %{HTTP_HOST} ^www.domain1.com$
RewriteCond %{REQUEST_URI} ^/files
RewriteRule ^files/(.*) sites/folderofdomain1/files/$1 [R]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.