WordPress.org

Ready to get started?Download WordPress

Forums

Redirect 2 old post ids to new ids? (4 posts)

  1. jcostom
    Member
    Posted 7 years ago #

    My blog recently underwent a cleansing of the old, i.e. the blog was re-started. So, two of my old entries were rather popular (howto guides), so I resurrected those posts.

    Now the problem.. The old posts were id's 403 and 428, which are now id's 17 and 20, respectively. This is my .htaccess, but the redirect doesn't seem to work properly.. If someone would show me the error of my ways, I'd be grateful, as would users seeking that content..

    BTW, the wp-trackback redir line DOES seem to work.

    Environment:

    Ubuntu 6.06.1 LTS Server, Apache 2.0.55, PHP 5.1.2, Mysql 5.0.22, WP 2.1.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-trackback.php.*$ - [F,L]
    RewriteRule ^archives/403 /archives/17 [QSA,L]
    RewriteRule ^archives/428 /archives/20 [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
  2. jrawle
    Member
    Posted 7 years ago #

    Is the problem the [L] flag? This stops the URL from being processed any further if it matches the rule. Yet you need it to be processed further so that the request can be passed to index.php.

  3. jcostom
    Member
    Posted 7 years ago #

    I've tried removing the L flag from those 2 lines, and it doesn't make a difference..

    Anyone have any further thoughts?

  4. jrawle
    Member
    Posted 7 years ago #

    I don't know what the QSA is doing either, so you could try remeoving this too. On another thread, someone reports that WordPress overwrites their htaccess. Are you sure the copy on your live server hasn't been overwritten, removing the rules?

    When you say it "doesn't seem to work properly", what happens? Do you get a different page? Error? Blank?

    Are the archives located at "archives" in your new blog?

    The rules aren't quite specific enough. I don't think this is the problem here, but if they did work, they could cause problems in the future by matching later posts.
    RewriteRule ^archives/403/?$ /archives/17
    would prevent this.

    I actually think a redirection would be more appropriate than a rewrite here. The pages have moved, so you should send a permanent redirect:
    Redirect permanent /archives/403 /archives/17
    That will send a 301 status code.

    If all else fails it might be better to edit the database to makes those posts have the same numbers as before. (You should probably set the post counter to begin from 429 too.) That will mean you don't need Rewrite/redirect rules in your htaccess forever.

Topic Closed

This topic has been closed to new replies.

About this Topic