Considering that Redirection plugin is broken in parts, I am currently thinking of…
#1 Using Simple URLs plugin by StudioPress.
It adds a new custom post type to your Admin menu, where you can
create, edit, delete, and manage URLs. It stores click counts in the
form of a custom field on that custom post type, so it scales really
well.
As fate would have it, the plugin does 301 redirects only. But luckily, to get it to do what I want (302 redirects), is as easy as replacing the two instances of 301
with 302
in the plugin’s plugin.php
file (line 152).
* * * * *
#2 setting wp_redirect
on posts using a custom field. This is the code I have in mind (untested) — based on this answer:
/* The value for 'wpse58864-302-redirects' custom field should be a URL.
* The post can be left blank, but should be published.
* You may have to prevent caching of these posts.
*/
add_action( 'template_redirect', 'wpse58864_redirect' );
function wpse58864_redirect(){
if ( get_post_meta($post->ID, '302-redirect', true) ) {
$redirect_302_to = get_post_meta($post->ID, '302-redirect', true);
wp_redirect( $redirect_302_to );
exit;
}
}
* * * * *
#3 This is a completely non-WordPress way. It’s very simple, basic and straightforward.
First, create a directory called go
(as in http://example.com/go/
) with an empty index.html
file in it. When you want to create a redirect, like say http://example.com/go/wordpress/
, simply drop a directory (wordpress
in this case) with an index.php
file with nothing but the following code, in go
.
<?php
header("Location: http://wordpress.org/");
exit;
?>
That’s all. http://example.com/go/wordpress/
should now redirect you to http://wordpress.org/