Changing directory and/or URL structure

I’m curious if its possible (and advisable) to change certain directory names and URL structure via customization by themes or plugins. For example, say I wanted the list of all a user’s posts to appear at instead of at…is this possible via customization? If so, would this type of customization be very problematic when it comes to things like forward compatibility with the latest WP updates and such?

Any advice anyone can offer on this would be most appreciated.



Solutions Collecting From Web of "Changing directory and/or URL structure"

@kureikain’s answer looks great, and it probably works really well in a wide variety of circumstances.

But for author URLs specifically, there’s a simpler way. Change the author_base, like so:

global $wp_rewrite;
$wp_rewrite->author_base = "people";

You should only need to run this once, perhaps on a plugin activation. Updating WordPress should not affect this solution.

As @Jan pointed out in the comments, you need to run this on every init. But you only have to flush the rules once.

You can use filter generate_rewrite_rules to add new custom url! The first, you add filter to create url! Second, you add new function to handle that URL (display wordpress profile in this case)

add_filter('generate_rewrite_rules', 'axcoto_multi_rate_rewrite');
function axcoto_multi_rate_rewrite(&$wp_rewrite) {
    $wp_rewrite->rules = array_merge(array('people/([^/]*)$' => 'index.php?pagename=people&username=$matches[1]'), $wp_rewrite->rules);
    return $wp_rewrite;

That way when someone go to people/kureikain, wordpress will make it become index.php?pagename=people&username=kureikain
Then you createa a new page and make its slug to people! Next you create a new custom page template to display that profile!

Beside, we add a new query var, username to above code! We need to let wordpress knows about it

add_filter('query_vars', 'axcoto_multi_rate_query_vars');
function axcoto_multi_rate_query_vars($public_query_vars) {
    $public_query_vars[] = 'username';
    return $public_query_vars;

In your code, to get username, you must call
$username = get_query_var(‘username’);
That’s all!

In my opinion it looks like the only thing you actually need is to change the author base, which this plugin will do for you(basically the same as what MathSmath posted, but in a glorified plugin form).