URL redirect widget for two media files in same gallery

Former Member
Former Member

We have two files in the same media gallery. Each needs to be redirected to a different URL. In other words: File 1 needs to be redirected to File 3, and File 2 needs to be redirected to File 4.

I found this widget on marketplace and installed it. I then went to File 1 (Page Not Found - M-Files Community), and clicked "Manage Site Theme/Edit Page". I installed the widget, configured it to direct it to the new URL. Then I logged in as a non-admin user and tested it, and lo and behold, it worked! Yay!

But don't celebrate yet....

Because then I go to File 2 (https://community.m-files.com/events/m/event-videos/21), and repeat the same process. Problem is that the widget is already installed due to my steps above, so now File 2 also redirects to File 3. I need it to redirect to File 4.

What's the catch here? There must be a way to redirect two files in the same gallery to two different places. I'm missing something. What is it? Thanks!

  • Hi jocelynvflint. I think this might not be the best use-case for a widget, or at least not this widget.

    A widget instance is configured across an entire theme, so it's on every media page in a gallery configured the same. It's not specific to a particular piece of content. As an aside, I'd generally not recommend redirection via widgets in the first place, even for cases where this widget could be used, but that would be mostly unrelated.

    As for what you're actually trying to do - are the redirections just to other/moved/copied media files? If so, simply moving the file to a new place will give it a new URL and also redirect anyone trying to use its old URL to the new file.

  • Former Member
    0 Former Member in reply to Michael Monteleone

    Thanks,  . The original files were deleted. This happened in the throes of pre-launch, so I can't even tell you exactly why they were deleted. ARGH. But now we have new files that have replaced that original content. Is there any workaround here? Or is this just one of those pesky launch mistakes that won't go away?

    Here's an example of an old URL: https://community.m-files.com/events/m/event-videos/21

    That now needs to redirect to a new URL: https://community.m-files.com/events/m/event-videos/24

    Ideas?

  • Ideally, this is a good match for the UrlRedirects API. It establishes redirects from one URL to another. This same API is used by the platform, itself, when moving existing content. But there is presently neither UI exposure of this API nor exposure to REST or scripting, so the only way to invoke it is through a plugin. I'm logging an item to review exposing this API to scripting and REST so it's consistent with other APIs. At least then, it could be just a scripting couple calls in Widget Studio to use. For now, it's still possible to use this via your own plugin. But if there's not many of them, it would probably be even easier to define redirects outside of Community like in the web server. 

    [embed:1a3cced3-af51-49ce-89e2-91f65855cd2d:c1054461-3428-49ce-bc63-853a2bec2d09:id=TE-16858]