Support » Fixing WordPress » How to move only pages to root with WP in subdirectory

  • I have an existing WP in a subdirectory “” plus a static site in the root.
    Now I want to delete that static site from the root and get only my pages from WP in that root, while WP installation and posts stay in that subdirectory /blog.

    I read a lot about moving stuff, but could not find a neat way to do this.
    Thanks in advance for any advice.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Pages are actually stored in your database, not as files.

    Easy method:
    Setup your new wordpress,
    Copy your database to the new site (there many are tutorials and tools on this. pick your poison). Backupbuddy is pretty good.
    Delete all of the stuff you didn’t want to migrate.

    Migrating stuff selectively *can* be done… its just not easy. if you haven’t migrated or copied a site before, then I wouldn’t be taking on this extra challenge just yet.

    Thanks for your reply jibbius, but maybe my post was not clear.

    It is not about moving, but about splitting the existing site, where only the existing “pages” should now appear in the root and the existing “posts” + WP stay in place in the subdirectory.

    I moved a lot of WP sites in the past btw.


    Right – so you’re actually asking about Permalinks?

    You want 1 site, with:

    To do this, simply:
    – Go to Settings > Permalinks
    – Select “custom structure”
    – Add “/blog/%postname%/” in the box at the end
    (this affects *only* your posts, not your pages)

    Ok, good idea doing that with permalinks, but …
    The WP installation is already in the /blog directory, so I guess I need to leave the posts as they are and put some code for the “pages” to go up to the root?

    You can use the steps here:
    Look at the heading “Using a pre-existing subdirectory install”.

    How I would do it:
    1. Backup both websites and databases!
    2. Export the Pages from (root) site, using Tools > Export… or any other method
    3. Import the Pages into the (subdirectory) site
    4. Delete the root site (but not the subdirectory site)
    5. Change the url & copy files as described in the link above
    6. Edit index.php as described in the link above
    7. Update the Permalinks page.

    1. you can try getting the root website, to use the database that belonged the subdirectory site (then delete the subdirectory).
    2. to do this you just change wp-config.php, and update home + siteurl in wp_options

    Backup everything before you change anything though.

    I think it is still not clear what I meant.
    • The old site in the root will be deleted completely.
    • The one and only site in the subdirectory stays there in /blog with installation and only the posts, while only the “pages” should appear in the root.

    So is it possible to get only the posts in /blog and to get the pages in the root?



    Forum Moderator

    Yes – if you use a sub-directory install and follow the instructions in Giving WordPress Its Own Directory.

    Thanks esmi.
    I understand the subdirectory install.
    Then when I make new pages they automatically appear in the root and by putting “blog” in the category base permalinks, all posts appear in /blog? Is that right?



    Forum Moderator

    Bingo! 🙂

    Just for the record, putting up the rest of the road I went.

    While the move seamed to work out right, I screwed up by using a script for changing links in the database. Had to use backup to start again 🙂
    So I decided to go for the WP installation in root to keep it simple.
    So far so good. Used Velvet-blues-plugin to change links in posts for pics. Ok.

    Then I used the category base /blog. But that appeared to put /blog instead of /category but it is not putting individual posts in /blog like: Which means that old urls to individual posts are changed.
    So I’ll have to try to fix that with some htaccess code, catching those mistakes and leading them to the right location.




    I need to do _exactly_ what you needed to do. Now that you’ve done it, do you know of a better way?

    It seems like it should be simple. Something like adding ‘..’ to the custom path to get the pages up a level from the subdirectory.

    It seems strange that this should be a convoluted fix.

    Did you learn any easier way?



    jedweb, sorry but lack of time made me leaving this as it is for the time being …
    Doesn’t seem to be simple indeed.
    Hope to solve this later …

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to move only pages to root with WP in subdirectory’ is closed to new replies.