WordPress.org

Ready to get started?Download WordPress

Forums

301 redirect for single posts in htaccess - stumped! (3 posts)

  1. nonno john
    Member
    Posted 2 years ago #

    A handful of old posts were deleted...and now trying to have old posts permalinks redirect to new posts. I placed the .htaccess file (below) in my /blog directory , but the redirect does NOT work ...instead, the browser returns "not found" (from WordPress Coraline 404.php template) when looking for http://mydomain.org/blog/?p=1111 (old post)

    # BEGIN WordPress
    Redirect 301 ?p=1111 http://mydomain.org/blog/?p=2222
    # END WordPress

    I only have about 8 of these redirects to do ...any help would be appreciated.

  2. adpawl
    Member
    Posted 2 years ago #

    hmm... you should use query_string rule
    something like that:

    RewriteCond %{QUERY_STRING} p=1111 [NC]
    RewriteRule (.*) http://mydomain.org/blog/?p=2222 [R=301,L]

    or use plugin like:
    http://wordpress.org/extend/plugins/redirect/
    http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/

  3. nonno john
    Member
    Posted 2 years ago #

    @adpawl

    worked like a charm ...can't thank you enough. here is the code placed in .htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{QUERY_STRING} p=1111 [NC]
    RewriteRule (.*) http://www.mydomain.org/blog/?p=2222 [R=301,L]
    </IfModule>
    # END WordPress

    great!

Topic Closed

This topic has been closed to new replies.

About this Topic