Redirect to PDF in Media Library

Jim Piller asked on September 16, 2021 19:41

We have just launched a website and are trying to setup some redirects from the old site to the new one using the standard web.config rewrite rules. This is working for things like redirecting the "www" to non-www address for the site, however, when we try to redirect a path to a file in the Media Library, we can't get it to work. We are just getting a 404 page when we try to access those PDF's.

I'm wondering 1) is this possible and 2) is this the correct way to handle this?

Any help would be appreciated.

Correct Answer

Dmitry Bastron answered on September 17, 2021 08:28

Hi Jim,

Getting media library file URL is not always straightforward. Please refer to this article explaining how you can get media library file URL.

In particular, if you have permanent links enabled or Azure/Amazon CDN integration, the URLs of your media files would be different.

However the easiest way to view the exact URL of your media file would be to open it in media library app and copy URL from there.

0 votesVote for this answer Unmark Correct answer

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