WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to move files from /blog to / without breaking links (12 posts)

  1. Christiaan
    Member
    Posted 8 years ago #

    I want to move my blog from /blog to /

    What's the best strategy to ensure that current links are not broken? I'm guessing the htaccess file is where the solution lies. If so can someone post a link to a resource that will explain how I configure it correctly?

  2. moshu
    Member
    Posted 8 years ago #

    See this tutorial Moving_WordPress - and ask back if you have more questions.

  3. splosh
    Member
    Posted 8 years ago #

    So that all your incoming links still work,I found this worked for me.

    leave a .htaccess file in the now empty original blog folder with this one line.

    redirect 301 /blog/ http://www.YOURSITE.com/

  4. Christiaan
    Member
    Posted 8 years ago #

    Yeah that would get a reader to my front page instead of a 404 error page (right?) but what I'm hoping I can do is configure htaccess to redirect each and every existing link to its relative page at my new address. For example:

    mydomain.com/blog/post100 ---> mydomain.com/post100
    mydomain.com/blog/post101 ---> mydomain.com/post101
    mydomain.com/blog/post102 ---> mydomain.com/post102
    ... and so on.

    Is this possible?

  5. splosh
    Member
    Posted 8 years ago #

    I'm pretty sure thats what it does..just the one line

  6. splosh
    Member
    Posted 8 years ago #

    I didnt make that very clear,

    do what I suggested and you get every page redirected to its corresponding page. Its like magic!!

  7. Christiaan
    Member
    Posted 8 years ago #

    Great, will try it. Thanks.

  8. Christiaan
    Member
    Posted 8 years ago #

    Wicked. Piece of cake. Didn't need to leave a htaccess file in the /blog directory either. Just added the code to the main htaccess file (which I'd moved to root). Thanks.

  9. splosh
    Member
    Posted 8 years ago #

    :)
    it all looks good except

    http://last-straw.net/blog

  10. Mark (podz)
    Support Maven
    Posted 8 years ago #

    redone your permalinks and deleted the /wp-content/cache directory ?

  11. Christiaan
    Member
    Posted 8 years ago #

    Oh yeah, http://last-straw.net/blog doesn't work but http://last-straw.net/blog/ does. What's that about?

    Yeap, redone my permalinks and deleted cache.

  12. Christiaan
    Member
    Posted 8 years ago #

    Added redirect 301 /blog http://last-straw.net/ and this appears to have fixed the problem. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic