• **NOTE: I’m not talking about “URL rewriting” in a server header sense. I’m talking about the relative URL path to the image file when you insert a photo into a post.

    I have 5 blogs set up via sub-domains on WP 3.0.1.

    The 4 “sub” blogs all have nice pretty URLs for embedded images cum sa:

    /files/yyyy/mm/…

    BUT. My main site is displaying the non-rewritten URL:

    /wp-content/blogs.dir/[BLOGID]/files/yyyy/mm/…

    Looking at the function wp_upload_dir in wp-includes/functions.php, line 2123, the function is checking if its the main blog, and skipping the URL rewrite part of the function.

    if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
    	$dir = ABSPATH . UPLOADS;
    	$url = trailingslashit( $siteurl ) . UPLOADS;
    }
    
    if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
    	if ( defined( 'BLOGUPLOADDIR' ) )
    		$dir = untrailingslashit(BLOGUPLOADDIR);
    	$url = str_replace( UPLOADS, 'files', $url );
    }

    Why does this function not serve up the rewritten URLs for the main blog? I would like all 5 of my blogs to have the “friendly” rewritten URLs.

    Finally, if i remove the “!$main_override” check in the final two if/then statements, the main blog behaves correctly in that when you embed a photo, it displays as

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

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Checking on my site, I can’t repro this.

    At a guess, the backend of your main site has blogs.dir listed for Upload Url Path

    Go to the Network Admin Menu and click on Sites. Then EDIT your main site and look for that value.

    Do you happen to be using a theme, perchance with thumbnails using timthumb, that someone modified so it would show the images from the sub-blogs correctly?

    that’s the only time I’ve seen it use the non rewritten image urls.

    A link to your site helps too.

    Nootron, can you help? I’ve been trying to get oEmbed working with the Title on top like you described.. However, it won’t ever work for some reason.

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