• I have protected all files. Old jpg files are correctly protected and only visible to logged in users.
    New pictures uploaded have a broken preview in the media library. Editing the picture shows the original image correctly. Since posts work with preview or smaller images there, they are shown as broken.

    What went wrong? How can I fix this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author GM_Alex

    (@gm_alex)

    Hi @marcusrieche82,

    I think your htaccess configuration could be wrong or not up to date and the new images are located in an other folder than the new ones, could that be?

    Regrads,
    Alex

    Thread Starter marcusrieche82

    (@marcusrieche82)

    All Images are in the same upload folder organized in sub folders by year and month. So yes the new pictures are in the 2021 folder with subfolders per month. Older pictures are therefore in 2019, 2018,… but all have the same upload root where the .htaccess is located.
    I tried turning it off and on again. So the .htaccess would be recreated. I tried using the custom option and used an example from the forum here.
    I checked file permissions, but I still have no clou why ../2017/04/DSM12345.jpeg can be shown and ../2021/02/DSM56789.jpeg not.

    While switching on and off the file protection I was able to get some new pictures shown. Maybe it was some more switching. But pictures uploaded after that are still not shown. So 2021 is not broken in general. But these pictures are located in different month folders below that.

    How should .htaccess look like?

    Plugin Author GM_Alex

    (@gm_alex)

    The behavior you are describing seems not that the htaccess is the culprit. It could depend on browser caching. Could you try it with an incognito tab and a user with full permissions?

    Thread Starter marcusrieche82

    (@marcusrieche82)

    The browser cache fooled me once or twice. I checked if my changes had any effect by using an anonymous new browser window. I am using an administrative user.
    But I ended up in the above situation.

    Plugin Author GM_Alex

    (@gm_alex)

    Ok so the only way is to figure out what’s going on would be to debug it on your site. If you wish to do so please contact me via twitter: https://twitter.com/GM_Alex

    Thread Starter marcusrieche82

    (@marcusrieche82)

    It is a Personal Blog. Family habe access and clone friends. So no advanced role management needed. But protecting family Photos is important. So this in .htaccess seems to Do the Job

    # require login for media files
    # more info: https://m0n.co/11
    <IfModule mod_rewrite.c>
    	RewriteCond %{REQUEST_FILENAME} (.*)
    	RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_([a-zA-Z0-9_]*) [NC]
    	RewriteRule .* - [F,L]
    </IfModule>

    Fonds here https://htaccessbook.com/require-login-access-wordpress-media-files/

    Thank you for your reply.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘New media broken or not protected’ is closed to new replies.