• Resolved ghassenpflug

    (@ghassenpflug)


    Hi Dennis,
    I use WordPress 5.1.1, have added the requisite ReWriteRule to my .htaccess file before the BEGIN WordPress block (see below), and copied some test images to wp-content/uploads/private/, both by hand on the server, as well as with Media File Manager plugin.
    Problem is, browser (Firefox 66.0.1) does not display any images, and in the admin media interface I also see just grey squares for the images in the folder.
    The error message in the browser is (with domain and image the corresponding actual names):

    The image “https://<domain>/wp-content/uploads/private/<image>&#8221; cannot be displayed because it contains errors.

    This happens with all test images, I have checked ownership and permissions. I even moved some images, and then moved them back to their original locations, where I could view them again.
    Any pointers would be most welcome! (one example given in “Link to the page you need help with”).

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    # Block unauthenticated user access to the /private/ uploads folder
    RewriteRule ^wp-content/uploads/(private)/(.*)$ /?pucd-folder=$1&pucd-file=$2 [L]
    </IfModule>

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chris Dennis

    (@chrisdennis)

    Hello

    I can’t check what’s wrong with that image because it’s private! — I get a 403 status code, which is exactly what should happen.

    And I can’t check your Apache settings because I don’t use Apache — the rewrite rule was provided by a contributor.

    Thread Starter ghassenpflug

    (@ghassenpflug)

    Hello Dennis, thanks for that reply. If that is the spec, fine, I can live with that. It just seems weird that that error message occurs. It seems to indicate that the image is not actually hidden very well (visitors can assume the image exists)—since if I choose a non-existent image name, a blank page is displayed.
    I thought that the idea was that one would get a request to log in (I don’t know what the RewriteRule is supposed to do).

    Plugin Author Chris Dennis

    (@chrisdennis)

    If a visitor tries to access an image (or other document) on a private WordPress post, then the site can prompt for a log-in if required — there are various ways to do that in WordPress.

    But an image attached to a private WordPress post can be accessed directly by anyone who knows or guesses its URL. That’s the issue that the Private Uploads plug-in addresses.

    You’ve made me think about whether the server should return a 404 (‘not found’) status code instead of 403 (‘forbidden’). As you say, the latter implies that the item exists.

    Plugin Author Chris Dennis

    (@chrisdennis)

    Resolved

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Images not visible in browser or media’ is closed to new replies.