Support » Plugins » Redirecting Old Permalinks to New Ones

  • I am looking for a way to redirect my old permalinks to the new ones. I am currently using the structure and am looking to change to for SEO purposes.

    I am fine with editing the code in the .htaccess file but would appreciate someone helping me out with that since I don’t really understand it that well. I’m obviously looking for a solution that will automatically do this for all posts rather than doing this for each individual post. We have well over 2000 posts and that would be virtually impossible.

    I have not found any past forum topics about this exact issue but if you find one, please send along the link.



Viewing 3 replies - 1 through 3 (of 3 total)
  • anyone know of a plugin to change these permalinks without loosing all of my posts that have already been indexed?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    You’re fortunate in that your “old” structure uses the post id. Because of this, some clever rewriting can get you more or less what you want.

    One lesser known fact is that even when you’re using “pretty” permalinks, you can still access individual posts by this method:

    So, in your case, this link:
    is equivalent to this link:

    Both go to the same entry.

    So if you want to do some rewriting via htaccess to convert the first one to the second one, you can. You’ll need to recognize the /entry/(numbers only) and rewrite accordingly.

    Might google “mod_rewrite” and try to figure out the syntax and such. It’s not particularly easy.

    I’m doing something similar… And found I needed to hand code a solution in my case.

    htaccess isn’t the solution, as you need to rewrite to the proper permalink. it needs to be done in code, I’m doing my work a bit ‘late’ in header.php at the moment, but might try moving it into a plugin so I can handle things right after plugins are done (and before the query actually executes).

    also, you may find you want to change from:[postID]
    to a different ‘string’ for identifying easily the new format:[post-slug]

    At that point, you want to check to see if the incoming url/request uses the old format, and if so grab the post from the db, have wp build a permalink for it (which, since you have changed formats is easy), and send back a permanent redirect to the new format permalink.

    If I find that I have a somewhat generalized-solution I can make into a plugin, I’ll let folks know. There IS a plugin out there that does redirects to the canonical form of a given permalink (so, lacking slash gets redirected to terminating slash, etc.), and that might give you a basis for making a plugin for yourself that has most of the heavy lifting done already. Worth a looksee.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirecting Old Permalinks to New Ones’ is closed to new replies.