Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 16559)
+++ wp-includes/taxonomy.php	(working copy)
@@ -19,10 +19,10 @@
 		'hierarchical' => true,
 	 	'update_count_callback' => '_update_post_term_count',
 		'query_var' => 'category_name',
-		'rewrite' => array(
+		'rewrite' => did_action( 'init' ) ? array(
 					'hierarchical' => true,
 					'slug' => get_option('category_base') ? get_option('category_base') : 'category',
-					'with_front' => false),
+					'with_front' => false) : false,
 		'public' => true,
 		'show_ui' => true,
 		'_builtin' => true,
@@ -32,9 +32,9 @@
 	 	'hierarchical' => false,
 		'update_count_callback' => '_update_post_term_count',
 		'query_var' => 'tag',
-		'rewrite' => array(
-					'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag' ,
-					'with_front' => false),
+		'rewrite' => did_action( 'init' ) ? array(
+					'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
+					'with_front' => false) : false,
 		'public' => true,
 		'show_ui' => true,
 		'_builtin' => true,
@@ -52,7 +52,7 @@
 		'show_ui' => false,
 		'_builtin' => true,
 		'show_in_nav_menus' => false,
-	) ) ;
+	) );
 
 	register_taxonomy( 'link_category', 'link', array(
 		'hierarchical' => false,
@@ -75,21 +75,25 @@
 		'public' => false,
 		'show_ui' => false,
 		'_builtin' => true,
-	) ) ;
+	) );
 
+	$rewrite = false;
+	if ( did_action( 'init' ) && current_theme_supports( 'post-formats' ) )
+		$rewrite = array( 'slug' => get_option( 'format_base' ) ? get_option( 'format_base' ) : 'type' );
+
 	register_taxonomy( 'post_format', 'post', array(
-		'public' => false,
+		'public' => true,
 		'hierarchical' => false,
 		'labels' => array(
 			'name' => '',
 			'singular_name' => '',
 		),
-		'query_var' => false,
-		'rewrite' => false,
+		'query_var' => 'post_format',
+		'rewrite' => $rewrite,
 		'show_ui' => false,
 		'_builtin' => true,
 		'show_in_nav_menus' => false,
-	) ) ;
+	) );
 }
 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
 
@@ -310,7 +314,7 @@
 		$wp->add_query_var($args['query_var']);
 	}
 
-	if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') && !empty($wp_rewrite) ) {
+	if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) {
 		$args['rewrite'] = wp_parse_args($args['rewrite'], array(
 			'slug' => sanitize_title_with_dashes($taxonomy),
 			'with_front' => true,
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 16559)
+++ wp-includes/post.php	(working copy)
@@ -5058,6 +5058,23 @@
 	return $strings;
 }
 
+function get_post_format_slugs() {
+	$slugs = array(
+		'default' => _x( 'default', 'Post format slug' ),
+		'aside'   => _x( 'aside',   'Post format slug' ),
+		'chat'    => _x( 'chat',    'Post format slug' ),
+		'gallery' => _x( 'gallery', 'Post format slug' ),
+		'link'    => _x( 'link',    'Post format slug' ),
+		'image'   => _x( 'image',   'Post format slug' ),
+		'quote'   => _x( 'quote',   'Post format slug' ),
+		'status'  => _x( 'status',  'Post format slug' ),
+		'video'   => _x( 'video',   'Post format slug' ),
+		'audio'   => _x( 'audio',   'Post format slug' ),
+	);
+	$slugs = array_map( 'sanitize_title_with_dashes', $slugs );
+	return $slugs;
+}
+
 /**
  * Returns a pretty, translated version of a post format slug
  *
@@ -5096,4 +5113,55 @@
 	return false;
 }
 
+/**
+ * Returns a link to a post format index.
+ *
+ * @since 3.1.0
+ *
+ * @param $format string Post format
+ * @return string Link
+ */
+function get_post_format_link( $format ) {
+	$term = get_term_by('slug', 'post-format-' . $format, 'post_format' );
+	if ( ! $term || is_wp_error( $term ) )
+		return false;
+	return get_term_link( $term );
+}
+
+/**
+ * Filters the request to allow for the format prefix.
+ *
+ * @access private
+ * @since 3.1.0
+ */
+function _post_format_request( $qvs ) {
+	if ( ! isset( $qvs['post_format'] ) )
+		return $qvs;
+	$slugs = array_flip( get_post_format_slugs() );
+	if ( isset( $slugs[ $qvs['post_format'] ] ) )
+		$qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ];
+	return $qvs;
+}
+add_filter( 'request', '_post_format_request' );
+
+/**
+ * Filters the post format term link to remove the format prefix.
+ *
+ * @access private
+ * @since 3.1.0
+ */
+function _post_format_link( $link, $term, $taxonomy ) {
+	global $wp_rewrite;
+	if ( 'post_format' != $taxonomy )
+		return $link;
+	$slugs = get_post_format_slugs();
+	if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) {
+		return str_replace( "/{$term->slug}", '/' . $slugs[ str_replace( 'post-format-', '', $term->slug ) ], $link );
+	} else {
+		$link = remove_query_arg( 'format', $link );
+		return add_query_arg( 'format', str_replace( 'post-format-', $term->slug ), $link );
+	}
+}
+add_filter( 'term_link', '_post_format_link', 10, 3 );
+
 ?>
Index: wp-admin/options-permalink.php
===================================================================
--- wp-admin/options-permalink.php	(revision 16559)
+++ wp-admin/options-permalink.php	(working copy)
@@ -97,11 +97,20 @@
 			$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
 		$wp_rewrite->set_tag_base( $tag_base );
 	}
+
+	if ( isset( $_POST['format_base'] ) ) {
+		$format_base = $_POST['format_base'];
+		if ( ! empty( $format_base ) )
+			$format_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $format_base ) );
+		update_option( 'format_base', $format_base );
+		$wp_rewrite->init();
+	}
 }
 
 $permalink_structure = get_option('permalink_structure');
 $category_base = get_option('category_base');
 $tag_base = get_option( 'tag_base' );
+$format_base = get_option( 'format_base' );
 
 if ( $iis7_permalinks ) {
 	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
@@ -160,6 +169,7 @@
 	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
 	$category_base = preg_replace( '|^/?blog|', '', $category_base );
 	$tag_base = preg_replace( '|^/?blog|', '', $tag_base );
+	$format_base = preg_replace( '|^/?blog|', '', $format_base );
 }
 
 $structures = array(
@@ -216,6 +226,12 @@
 		<th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
 		<td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
 	</tr>
+<?php if ( current_theme_supports( 'post-formats' ) ) : ?>
+	<tr>
+		<th><label for="format_base"><?php _e('Format base'); ?></label></th>
+		<td><?php echo $blog_prefix; ?> <input name="format_base" id="format_base" type="text" value="<?php echo esc_attr($format_base); ?>" class="regular-text code" /></td>
+	</tr>
+<?php endif; ?>
 	<?php do_settings_fields('permalink', 'optional'); ?>
 </table>
 
