Title: Multisite main site wp_upload_dir
Last modified: August 19, 2016

---

# Multisite main site wp_upload_dir

 *  [William](https://wordpress.org/support/users/nootron/)
 * (@nootron)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multisite-main-site-wp_upload_dir/)
 * **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)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multisite-main-site-wp_upload_dir/#post-1784849)
 * 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.
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/multisite-main-site-wp_upload_dir/#post-1784885)
 * 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.
 *  [thinkunique](https://wordpress.org/support/users/thinkunique/)
 * (@thinkunique)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/multisite-main-site-wp_upload_dir/#post-1785238)
 * 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.

## Tags

 * [upload url](https://wordpress.org/support/topic-tag/upload-url/)
 * [wp_upload_dir](https://wordpress.org/support/topic-tag/wp_upload_dir/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 3 replies
 * 4 participants
 * Last reply from: [thinkunique](https://wordpress.org/support/users/thinkunique/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/multisite-main-site-wp_upload_dir/#post-1785238)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
