WordPress.org

Ready to get started?Download WordPress

Forums

Currently using /%postname% as permalink, want to change, but not break links (13 posts)

  1. mandazi
    Member
    Posted 3 years ago #

    Hello,

    My permalink structure for posts is currently:
    /%postname%

    I want to change it to something like /%category%/%postname# or /post/#postname# but I don't want all the current URLs to break that link to my site. I currently have it set up with facebook and twitter and 1000s of URLs will break if I change the permalink.

    Is it possible to create some type of modrewrite rules to check if the URL is /%postname% and then redirect to the new permalink structure?

    Thanks

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    It is my understanding that when you change permalink structure, the old links still work.... they just redirect to the new links

    I just changed over my blog from date based to /%category%/%postname%/ with about 1000 posts. Everything went smoothly, and if you visit any of my old URLs, you are automagically forwarded.

    As always, its a good idea to backup your database before making any changes like this

  3. mandazi
    Member
    Posted 3 years ago #

    @Rev. Voodoo - I just changed it to "test/%postname#" and the old links didn't work. It went to 404 Page Not Found.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    "test/%postname#"

    You put that in the permalinks setting? That's not a valid permalink setting.... what are you trying to go to?

    category/postname?

    If so,

    /%category%/%postname%/

    is exactly what would go in the permalink box

  5. mandazi
    Member
    Posted 3 years ago #

    I don't want to use the category in the post permalink. I just want it to have some text like "/post/%postname%" because I read in the documentation it's bad to have the permalink just "/%postname%" so I am thinking if I just add some text before it, it should be fine, but I want to make sure all the current links won't become 404, which is what happened when I changed the permalink to "/test/%postname%".

    Hopefully that makes sense.

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    adding text before it won't help for that purpose

    you'd want to use a variable number (EDIT, readin Otto's article, your static idea might be just fine)

    like post ID or something

    There's a real good article on that, let me find it

    EDIT
    http://ottopress.com/2010/category-in-permalinks-considered-harmful/
    Here ya go, this may help you

    As for the problems you are having, did you include the trainling slash in your permalink settings? You didn't in the above post, just curious

  7. mandazi
    Member
    Posted 3 years ago #

    Okay so looks like I can't use %category%/%postname#.

    I have a big problem them. I have over a 1000 posts for over 3+ years with the permalinks being just /%postname%. Now if I change it and add the post ID or the date to the permalink all the current URLs will go to 404.

    How do I make /%postname% redirect to whatever new permalink I decide on?

  8. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    I'm not sure why you'd be having trouble with changing your permalinks. Do you have any plugin or anything that could be messing with it?

    Like I stated earlier, I just recently changed my permalink structure, and everything redirected automatically. I can put in my old url and get to the same posts.

  9. mandazi
    Member
    Posted 3 years ago #

    It might be the All in one SEO plugin that has some mod rewrite rules. I will investigate. Thanks for your help.

  10. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Sure, hopefully you get it figured out.

    I've changed my permalinks a few times over the years as I changed my mind. All posts have always remained accessible for me

  11. mandazi
    Member
    Posted 3 years ago #

    Even the previous versions of the links?

  12. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Yes, If I put in the old url, which would look like
    domain.com/2009/10/postname

    it redirects to
    domain.com/category/postname

    Which is great, because all my old hardcoded links to posts inside of old posts work

    Here's an example:
    http://www.rvoodoo.com/2010/03/using-access-logs-to-find-rogue-files-when-wordpress-is-hacked/

    is an old post, with my old permalink structure..... visit the link and look at the URL it takes you to

  13. mandazi
    Member
    Posted 3 years ago #

    Wow I wish I could happen to mine, I think there is a permalink for the pages that checks the root is conflicting with when I change the permalink, so that's why it's going to 404.

    Basically, I've doomed myself, haha. Using the %postname# only as the permalink only reduces the performance which isn't too bad.

Topic Closed

This topic has been closed to new replies.

About this Topic