Media library and Virtual Directory

Mike Rahel asked on April 25, 2018 23:31

I have Kentico 9.0 running and we have moved the media items outside of the filesystem to a separate media drive on the server.

Some of the files in the media library, though, need to be accessed inside the filesystem via a relative URL while still maintaining the separation of media files.

We decided to use a virtual directory in IIS that points to the original location of sitename/media/content-files/ but has a target of the F:/MediaTest folder we created. However, when I try to access these files inside Kentico with a relative path, I just get a 404. Is there something I can do to get this working?

Recent Answers

Peter Mogilnitski answered on April 26, 2018 02:26 (last edited on April 26, 2018 04:25)

Take a look at Configuring custom storage for media libraries. I guess if you enter F:\MediaTest to Settings -> Content -> Media -> Media libraries folder you can move the whole media library to different drive.

When you change the location of the media library folders, the system does NOT automatically move existing media files and sub-folders to the new location. To ensure that your media content is accessible and works correctly, you need to manually move the files from the old location to the new one in the file system. You have to copy your media library to F:\MediaTest\<site code name>\...

P.S. You can't just move out one folder from media library - you have to move the whole media library.

0 votesVote for this answer Mark as a Correct answer

Mike Rahel answered on May 9, 2018 17:26

Yes, we have successfully moved the media library out to the F:/ drive including migrating existing items to that new location. However, some of the items in question require us to be able to use a relative path (which you cannot do in Kentico once you moved the files to a remote location - you can only use the getmedia handler with a GUID which won't work for this instance). Therefore, I set up the virtual directory hoping that I would still be able to access the files inside of Kentico via a relative path to the virtual directory location. I also had to exclude this location from the URL rewriting in Kentico via Settings > URLs and SEO > Excluded URLs.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.