• I am desperately searching for a solution to shorten URLs of media library files – without using external services or direct handling with rewrite rules. Only a few and bad WP Plugins exist for this.
    I appreciate MLA as one of the few really good solution for a media library we have the right expect in a professional CMS.
    So I come to the idea using MLA also for short file URLs:
    Would it be possible to overwrite e.g. the .pdf MIME Type and set “pdf” as the slug and get the file via site.url/pdf/filnename.pdf (as an alternative to site.url/wp-content-directory/year/month/filename.pdf)? Further, may the author be able to insert that short URL when using the file insertion dialogue?
    Thanks in advance for comments, hints, ideas.

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your positive feedback on MLA and for an interesting question. As I understand it, your URL-shortening application has two parts:

    1. Create rewrite rules for Media Library items to provide a short, sensible URL in place of the WordPress default.
    2. Provide a user interface for managing the rewrites and inserting them into posts/pages.

    My own experience with .htaccess files and URL rewrite rules has been limited to a few bad encounters; I understand your desire to avoid them. I have been using another WordPress plugin for several years with good results:

    Redirection, by John Godley (at Urban Giraffe)

    I don’t know if that’s on your list of “Only a few and bad WP Plugins“.

    I can imagine using Redirection as the rewrite engine and MLA as the user interface. I haven’t look for an API in the Redirection code but overall it looks solid and well-structured. MLA provides over 100 hooks (actions & filters) that provide good control over the Media/Assistant submenu, mapping rules, etc. I am confident that a small custom plugin or code added to your theme could combine the two plugins and give you a good solution.

    It also occurs to me that using MLA’s [mla_gallery] shortcode to add items to posts/pages may be a good alternative to “using the file insertion dialogue“. With that approach managing the short URLs does not require finding and fixing hard-coded entries in the post/page content. Have you considered that?

    I am traveling until August 12, but I can have a closer look at this when I return. If Redirection is a possibility, perhaps you could raise your idea with the author and ask about API access.

    I will leave this topic unresolved until I hear back from you. Let me know if and how you would like to proceed. Any additional details on your application would be helpful. Thank you for your interest in the plugin.

    Plugin Author David Lingren

    (@dglingren)

    If you haven’t solved your “short file URL” requirements yet you may be interested in this other support topic along similar lines:

    Attachment update action hook?

    If you think twcfan92’s solution might apply to your application, try posting an update in the other topic and see if he will post his code or more details.

    If you have completed a solution of your own, let me know so I can resolve this topic. Thank you!

    Plugin Author David Lingren

    (@dglingren)

    I has been a month since your last post in this topic. I assume you found a solution to your application requirements.

    I am making this topic resolved, but please update it if you have any more details or questions regarding your URL-shortening application. Thanks for your interest in the plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortening File URLs via MIME Type Processing Slug?’ is closed to new replies.