How-to add rewrite rules to point the uploads folder to a subdomain

If you are not willing to filter only image uploads, i.e., all uploaded media will reside in the same folder/subdomain, then there’s a simple configuration solution: go to options-media.php set the Store uploads option to wp-content/uploads set the Full URL option to http://uploads.yourdomain.com create a subdomain making the uploads folder be http://uploads.yourdomain.com

How to add a custom URL placeholder to author archives?

Option 1 I assume custom post type generate a URL something like this domain.com/%custom-post-type%/%list% So you could write it so it looks as… since the main URL doesn’t have author before custom type you would have to do this via a function since authors are dynamic RewriteRule ^members/%author%/(.*)$ domain.com/%custom-post-type%/$1 This doesn’t specifically modify the custom … Read more

External/non-WP rewrite rules

Here are some notes. Install Toschos rewrite plugin Install Jan Fabrys rewrite analyzer plugin. Use the Rewrite API Add your rules to top. There’s also the function add_external_rule(), which should be accessible via $GLOBALS[‘wp_rewrite’]->add_external_rule(); All your external rules are accessible via $wp_rewrite->non_wp_rules. Here’re the internals, that show you how the rules get added inside $wp_rewrite->mod_rewrite_rules(): … Read more

Clash of the rewrites

Your best option is to register neighborhoods as a custom taxonomy and use that instead of categories. In your theme’s functions.php file, you just need to add: function neighborhoods_init() { // create a new taxonomy register_taxonomy( ‘neighborhoods’, ‘post’, array( ‘label’ => __( ‘Neighborhoods’ ), ‘hierarchical’ => true ) ); } add_action( ‘init’, ‘neighborhoods_init’ ); Next, … Read more

Date based URLs for custom posts and pagination

Calling $GLOBALS[“wp_rewrite”]->flush_rules() did make everything work as I required but that wouldn’t be a good solution. Actually, you have to flush the rewrite rules after modifying them (i.e. also when registering custom post types). Also, you should never rely on these global variables. WordPress provides specific functions for nearly everything. For example, use flush_rewrite_rules() instead … Read more