Skip to:
Content
Pages
Categories
Search
Top
Bottom

Accessing media redirects to 404 error

Viewing 7 replies - 1 through 7 (of 7 total)

  • r-a-y
    Keymaster

    @r-a-y

    Hey Peter,

    Sounds like a RewriteRule problem.

    Check your .htaccess file and see if you have a line like:

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]


    Peter Anselmo
    Participant

    @peteranselmo

    Ray,

    Yes, that was my first instinct as well, and yes, there is something similar in the .htaccess file.

    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    Here’s my issue: I have another test install with the exact same .htaccess file, and it’s working fine.

    WPMU 2.8.6/BP1.1 – Doesn’t work

    WPMU 2.9/BP1.2 – Works

    Same .htaccess

    Here’s an example of the same path, in a different install, that’s working:

    http://wpmu.sixtysixinc.com/wpmu2.9/wp-content/blogs.dir/1/files/group-documents/5/1266345458-score.jpg


    Peter Anselmo
    Participant

    @peteranselmo

    I’m not a RegEx pro, but looking at the above rules more carefully, something still doesn’t seem right to me.

    RewriteRule ^(.*/)?files/$ index.php [L]

    – URLs ending with ‘files/’ go to the home page. (doesn’t apply)

    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

    – Make an exception for urls in the plugins folder (doesn’t apply)

    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    – Urls with ‘files’ get directed to blogs.php?file=… This seems closer, but it’s not actually being directed to blogs.php (or maybe it is, and it’s being directed back to the image the the file variable still appended).

    :-(


    r-a-y
    Keymaster

    @r-a-y

    Hey Peter,

    Just wanted to note that you don’t need to put the /wp-content/blog.dir/1/files/ line in your group documents URL

    You should be able to put /files/ and it should still work.

    This doesn’t solve your issue though.

    You’re right about this line:

    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    Your BP group documents are not being directed to blogs.php.

    Did you check to see if any other files outside BP Group Documents work?

    Try uploading something to the WP Media Library and see what happens.


    Peter Anselmo
    Participant

    @peteranselmo

    Ray,

    Thanks for the replies. I was using the full wp-content/blog.dir/group_id path as that’s what avatars and several other components use. Which brings me to your next question – files outside of group documents. Yes, they’re working, even with a very similar path.

    Check out the avatar for this group (The dog photo):

    http://wpmu.sixtysixinc.com/wpmu2.8.6/groups/my-group/documents/

    It has the exact same url structure as the documents:

    http://wpmu.sixtysixinc.com/wpmu2.8.6/wp-content/blogs.dir/1/files/group-avatars/3/0fde224e7a1e14965943249bc7fa519b-bpthumb.jpg

    Yet, it’s not getting redirected, and it works fine.


    Peter Anselmo
    Participant

    @peteranselmo

    @r-a-y

    Wow. After 3 days of banging my head against a wall, I finally figured it out. It was so simple.

    There is in fact no difference in the way BP 1.1 or BP 1.2 handle the redirects and files directory.

    My code was appending a slash to the file name (during storage) in BP1.1 (I had to do conditional code because 1.1 doesn’t have bp_core_avatar_upload_path).

    Thus, in my BP1.1 installation, I was trying to access a directory.

    When I had verified the file was on the server, I was using “ls -l”; I was so busy looking at filenames and permissions, I missed the little “d” at the start of the line.

    D is for “Doh”.

    FYI, I found in my research that blogs.php is in fact being called, but of course, rewrite URLs aren’t shown in the actual URL, so it was silly to come to the earlier conclusion.


    r-a-y
    Keymaster

    @r-a-y

    Sometimes it’s the things we overlook ;)

    Glad you figured it out, Peter!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Accessing media redirects to 404 error’ is closed to new replies.
Skip to toolbar