• Hi…

    I am migrating a few of my blogs to one multisite installation with domain mapping to reduce maintenance effort. I followed the instructions, i.e. did the “export/import” dance.

    On one of them (http://www.brillianteams.com), there were two white papers as attachments. They have been properly to a new location (wp-content/uploads/sites/…), but I can’t find them as attachments and don’t know how to link to them. They aren’t attached to a page or post but referred to by widget texts and other places on the blog.

    Experimentally, I’ve added a file, too, and it got a URL in subdomain format (brillianteams.mainsite.com/?attachment_id=(number)). This is of course also unacceptable, I need the attachment link to point to the “right” domain name.

    In case you wonder, I can’t make brillianteams the primary domain because it has a dozen or so domain aliases to cover popular typos.

    Last but not least, when I set up that blog in the multisite environment, I forgot to enable attachment type “epub” and can’t find the place to correct that setting anymore.

    So here are my questions:

    1. Is there a simple way to link to the reasonably properly uploaded PDF and ePub files?
    2. How can I link to attachments with the “right” domain name in a multisite environment?
    3. How can I enable forgotten attachment types?

    Thank you all!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    but I can’t find them as attachments and don’t know how to link to them. They aren’t attached to a page or post but referred to by widget texts and other places on the blog.

    Are they in your media dashboard?

    1. Is there a simple way to link to the reasonably properly uploaded PDF and ePub files?

    Just … link to them. You know <a href="http://domain.com/path/to/doc.pdf">My PDF!</a> and so on.

    How can I link to attachments with the “right” domain name in a multisite environment?

    They’re aliases, so <a href="http://subdomain.domain.com/path/to/doc.pdf">My PDF!</a>

    I think I’m not understanding the question on that one… If the file’s uploaded to the correct site, it should show the correct domain name.

    How can I enable forgotten attachment types?

    Two fold.

    1) .htaccess add this:

    # Add filetypes
    AddType application/x-mobipocket-ebook mobi
    AddType application/epub+zip epub .epub

    2) Make an MU-plugin like:

    <?php
    /*
    Plugin Name: Mime Types
    Description: Missing Mimes
    */
    
    // Mimes
    add_filter('upload_mimes', 'add_custom_upload_mimes');
    function add_custom_upload_mimes($existing_mimes){
    	$existing_mimes['epub'] = 'application/epub+zip'; //allow epub files
    	$existing_mimes['webm'] = 'video/webm'; //allow epub file
    	return $existing_mimes;
    }
    Thread Starter Josef

    (@grainger)

    Hi Mika,
    thanks for looking into this.

    Are they in your media dashboard?

    No. I didn’t realize until you asked, but that’s of course where they should be. Any way to “rescan” the media directory? Uploading again will lead to different URLs, which is undesirable but OK if need be.

    They’re aliases, so <a href="http://subdomain.domain.com/path/to/doc.pdf">My PDF!</a>

    I think I’m not understanding the question on that one… If the file’s uploaded to the correct site, it should show the correct domain name.

    I’m afraid not. For the file I’ve uploaded since the installation, the attachment seems to point to an endless loop of redirects. Let me take it slow. The media library currently contains one file. The link to that file is: http://brillianteams.digitaler-heimwerker.de/?attachment_id=12946 (contains the undesired subdomain.domain.tld format). Clicking that link seems to lead to an infinite redirect loop between brillianteams.com and brillianteams.digitaler-heimwerker.de

    For the rest, I’m missing where I can find the link.

    forgotten attachment types

    Seriously? There is no way in the backend? No way to do that per site? That’s hard to believe, seeing all the perfectionism that has gone into WordPress over the years (I’m with WordPress since at least 2009).

    Anyways, thanks SO MUCH for your effort!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Okay well problem number one, and really the gist of all this, is that they’re NOT in the media library 🙂

    Were they PREVIOUSLY in the media library? It’s okay if you don’t know 🙂

    The link to that file is: http://brillianteams.digitaler-heimwerker.de/?attachment_id=12946 (contains the undesired subdomain.domain.tld format). Clicking that link seems to lead to an infinite redirect loop between brillianteams.com and brillianteams.digitaler-heimwerker.de

    How did you map the domains?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Attachments’ is closed to new replies.