WordPress.org

Ready to get started?Download WordPress

Forums

What happens if you change permalink structure multiple times? (9 posts)

  1. HowToBlog
    Member
    Posted 8 years ago #

    I'm curious as to what happens if you have already set up custom permalinks ('pretty permalinks') and later decide that you want to change the structure -- how does WordPress then handle requests for posts using the former URL structure? Does it set up 301 redirects to the new location? Is it able to forward users to the new permalink or do they get a 404 error?

    I originally set up my custom permalinks to be of the form /%postname%-%postid%.htm but it turns out that that's resulting in REALLY long URLs (which means when someone goes to email the URL from one of my posts, it's often broken by the email program b/c it takes up more than one line).

    As such, I now would like to change the custom permalink structure again, but am afraid of what will happen to all of the inbound links to the existing posts with the original custom permalink structure.

    Can someone please let me know what to expect when changing a blog with 100+ posts from one custom permalink structure to another?

    Is setting up the custom permalink structure something that can only be done when you first setup your WordPress blog or does WordPress gracefully remember your old structure and redirect visitors to the new URLs? Or do you have to manually set up 301 redirects in the .htaccess for each individual URL if you want to change your permalink structure a second time?

    Very much looking forward to any help that anyone can provide on this issue. As it is, I'm already dealing with problems with URL changes since I finally moved How to Blog from a subdomain on typepad to my own domain powered by WordPress (which I'm so excited about (I love WordPress!!) but am a little freaked about the loss in all my google traffic...and Six Apart refuses to let me set up 301 redirects from the old typepad blog - jerks)

    TIA for the help!!
    Emily

  2. projectego
    Member
    Posted 8 years ago #

    As far as I'm aware, all of your old links will generate very unattractive 404's (at least they did when I attempted the same thing a few weeks ago).

    I would suggest adding a 301 redirect from the old urls to the new urls in your .httaccess file.

  3. HowToBlog
    Member
    Posted 8 years ago #

    Argh - that's just what I was hoping not to hear.

    Thanks for the feedback, projectego!

    Now I'll need to figure out whether it's worth the hassle of manually setting up 301 redirects for 117+ posts in order to have a more compact URL or just live with it the way it is....

    Suggestions? How many browsers still break a two line URL such that it's not clickable? I wish there was a plugin that could automatically tinyurl my links when someone wanted to email them to someone :(

  4. maerk
    Member
    Posted 8 years ago #

    Have a look at RedirectMatch instead of just plain Redirect. That way you can write an expression to take care of a wide range of URLs.

  5. HowToBlog
    Member
    Posted 8 years ago #

    Thanks maerk -- looks promising! if only I could wrap my head around the regular expressions enough to figure out the correct way to go with this but I've been working for 11 hour straight and my head is spinning at this point..

    *aside* - i'm still wondering why wordpress created such uber-long URLs for me in the first place (other installations of it that I've got on my server have always automatically truncated the URL after a certain number of characters..)

  6. WPChina
    Member
    Posted 8 years ago #

    Sorry, but can someone give me an example of what a 301 redirect will look like in the htaccess?

    For example, if my old URL was (notice the ?):
    http://www.blog.com/%postname%?%postid%

    but now I switch to something like:

    http://www.blog.com/%postname%/

    what would my htaccess look like?

    Many tks!

  7. maerk
    Member
    Posted 8 years ago #

    @HowToBlog:

    What are the "before and after" URLs, could you post some examples? Actually, regular expressions are quite easy once you get the hang of them. You'll probably be surprised at how little you need.

    Some regular expressions links:

    @WordpressChina:

    Actually, your .htaccess would probably look the same.

    Older versions of wordpress used to get the server to process each request (i.e. a request for a page, a post, an archive or a category, etc.) and then retrieve the right wordpress file.

    The latest versions of wordpress use a different system: the server passess the whole URL to wordpress, and then wordpress figures out what to do with it.

  8. HowToBlog
    Member
    Posted 8 years ago #

    @maerk - Thanks for the help

    looks like any form of %postname% in the permalink is going to cause really long URLs for me, so a switch in permalink structure probably isn't going to help me if I still want to remain search engine friendly...

    The main problem now stems from the fact that when users email a link to someone, in many email programs the link will get cut off b/c it wraps around and takes 2 lines...

    I'm working with Phil Hord on trying to get his plugin which redirects truncated URLs to the correct post to work on my site, but so far we haven't had much luck..

    Any ideas on something I could put in the .htaccess file that would help with directing folks to the intended post instead of a 404 when they click on a url that their email program has broken by truncating it?

  9. billda
    Member
    Posted 7 years ago #

    Checkout Permalink Migration plugin.

    You specify your old permalink structure, and it issues search engine friendly 301 redirects for all your old URLs.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags