Opened 2 months ago

Last modified 2 months ago

#23755 new defect (bug)

Old /files/ support in new installs

Reported by: unsalkorkmaz Owned by:
Priority: normal Milestone: Awaiting Review
Component: Multisite Version:
Severity: minor Keywords:
Cc:

Description

I moved a blog to a new network that using new upload folder system. Problem is: old /files/ links that using ms-files.php are not working.

My temporary fix:
Added in .htaccess:

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

Added ms-files.php:

define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/uploads/sites/{$current_blog->blog_id}/" );

above of:

$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET[ 'file' ] );

Solution is working but I am not happy because it needs to edit core files. Is this working as intended? If it is, what is proper way to define BLOGUPLOADDIR for ms-files.php without breaking anything or editing ms-files.php

Change History (2)

oh btw i replaced all /files/ links inside blog. Problem is outside links like facebook posts. There is no way to edit those old posts and i need to support old /files/ links for that.

  • Component changed from Filesystem to Multisite

Related: #19235

Note: See TracTickets for help on using tickets.