How to do 302 redirects “in” WordPress using Redirection plugin?

I am planning to use the Redirection plugin to do redirects. The plugin’s description states that it also enables 302 redirects, but I can’t see how. There’s no option as such (see screenshot below).

Redirections plugin screenshot

Read More

Am I looking in the wrong place? Does anyone know how to do 302 redirects using Redirections plugin?

Related posts

Leave a Reply

2 comments

  1. 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/

  2. Coming a little late to the party here, but hopefully someone else will find this helpful.

    I found I was able to change redirects to 302s using the Redirection plugin in the following manner:

    1. Create and activate a redirect.
    2. In the list of redirects, click on the link to the redirect. If you roll over the link, your status bar just shows the URL which you are linking from. This is misleading—if you click on the link, you’ll be able to edit your redirect.
    3. When you edit your redirect, you get the pull-down allowing you to change the status code.

    BUT: This does not work if you choose the last option, matching “URL and login status”. This was what I wanted to do, so I could easily edit these pages while sending visitor traffic elsewhere. I decided that the 302 code was more important, and if I needed to see the pages while editing, I could use the preview link, e.g., “page_id=109&preview=true”.