Ticket #4554: canonical_trailing_slash.diff
File canonical_trailing_slash.diff, 1.0 KB (added by , 17 years ago) |
---|
-
wp-includes/default-filters.php
183 183 add_action('init', 'smilies_init', 5); 184 184 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 185 185 add_action( 'shutdown', 'wp_ob_end_flush_all', 1); 186 add_action( 'parse_request', 'canonical_trailing_slash'); 186 187 187 188 ?> 189 No newline at end of file -
wp-includes/functions.php
1317 1317 while ( @ob_end_flush() ); 1318 1318 } 1319 1319 1320 function canonical_trailing_slash( $request ) { 1321 if ( ! $request->did_permalink ) 1322 return; 1323 1324 if ( !empty($request->query_vars['error']) ) 1325 return; 1326 1327 $req = $_SERVER['REQUEST_URI']; 1328 $req = user_trailingslashit($req); 1329 if ( $req == $_SERVER['REQUEST_URI'] ) 1330 return; 1331 1332 wp_redirect($req, '301'); 1333 exit; 1334 } 1335 1320 1336 ?>