The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Migrating WordPress from subdomain to root

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
  • #30999


    I have been thinking about doing this for some time and with Christmas holidays coming up thought it might be a good use of downtime from work.

    I originally setup my wordpress install as and am thinking now that all of my static pages are handled by wordpress at and all I am using for is an entry page, since WP has grown up to be a pretty good CMS, I really should move everything to

    I have done some reading on this and it appears that there might be more than one way to do it.

    Either way though, there will be plenty of redirection going on to save my current SEO.

    I was wondering if any of the experts here would have opinions on the best way to do this, the pitfalls, the things to watch out for, the preparation etc.?

    Thanks in advance!



    Someone asked this in the WordPress forums:

    I’ll summarise, it will likely be a headache without a plugin:

    I have not used this myself, I suggest that once you make the changes check EVERYTHING – posts, pages, media, feeds and strangely wp-admin/

    If it breaks, change it back and reassess…


    Hi Clokey,

    I have read that thread and just had a look at the plugin. I’m not sure this will be the solution I am looking for since the issue is not what I have. The thread and the plugin solve the problem of changing your permalinks but what I wish to do is change where my wordpress installation exists. It exists now in and I want to move it to my root domain, not just change my permalinks.

    Unless I am thinking too black and white, I can’t see how this would


    I changed from a ‘subfolder’ to the root of my server and didn’t think of the problem of like this. I did however just try this plugin to see if it could fix the really old links – it failed.

    If you are moving the WordPress index.php, and altering the values on the Admin page (as per: ) then it may have to be a .htaccess RedirectMatch moment. I’ll try a few .htaccess approached, to see what happens.

    Could you clarify that you are just shifting all of your URL’s down a directory like I did?



    I installed my wordpress into the subfolder, now I would like to take it out of the subfolder and put it in the root.

    I think a new install is in order, and then use the importer to bring everything back in to the new installation. Any links that are hardcoded internally to http://www.mydomain/blog/… will have to be changed and of course everything will have to be redirected to maintain incoming links and seo.

    That’s where I am trying to determine the best way to proceed, as I have over 500 pages and images…


    Oh, btw, I found this post which is pretty timely, but not a complete solution for what I want to do.


    So what I am hearing is that you want to move all of your wordpress files out of the directory its in, into the main root folder of your site?

    First of all, back up all your files! You have to move all your wordpress files to the root. Then, you need to go into your database (via phpmyadmin) and change the wp_options table to the new address where your wordpress installation lives; the files under that table that you need to change are the “siteurl” and the “home” file (change to After you do that, then you can log in to your worpress account under the new domain and you will have to reset your permalinks (You may need to do a directory index on your .htaccess file to tell it to use index.php so it will use your wordpress installation as the site). You will also need to replace all your links with the new domain so your images and what not will work. I would use the search and replace plug in ( Replace your old domain with the new one on everything. You shouldn’t have to touch your config.php file at all unless your database is changing or moving, but it sounds like you still want to use the same one. That should do it, and hopefully that all makes sense.


    AustinKnight –

    Thanks! Yes, this would be one way to accomplish what I am thinking of doing and I have to wonder if it is the best, easiest.

    The other idea that has popped up is to simply leave my installation at and figure out how to strip the /blog/ out of the urls and have my wordpress home page at without physically moving the wordpress files.

    Under “General Settings” there are two fields:

    WordPress address (URL) which is set for
    Site address (URL) which is also set for and this second one is annotated with:
    “Enter the address here if you want your site homepage to be different from the directory you installed WordPress.”

    I visited the codex link on the second option and it really only gives info about going the other way. I’m confused as to what this option does, means.

    Would simply changing this second option to solve my questions?


    Site address would be the “home” for the site. If the main site was a shop, and wordpress handled a side blog then changing this would change any link ‘home’ to the shop – unless the index.php of your wordpress install was moved as per my last comment.

    I have managed to get my old links working though. But I don’t have a clue how!

    Anything extra in my URL’s get scrapped… i.e. redirects correctly to

    It may be one of my plugins causing the redirect, but none have been updated?

    May it might be worth just changing the site (try these kind instructions: and seeing what happens, if it fails just reverse the procedure!

    Sorry no definite answers…


    May it might be worth just changing the site (try these kind instructions: and seeing what happens, if it fails just reverse the procedure!

    That’s the way to do it! Excellent find Clokey, thanks!


    It’s the same information as provided on the WordPress codex, just worded from the other perspective.

    This is the method I used;


    how did you handle your redirects? I tried using redirection plugin regular expression setting and put source: /blog/* and target as /
    this caused problems of course since wp-admin lives in /blog/wp-admin so I couldn’t log in, also I got Ajax error on every page. Good news was that every page got redirected… so I am back to square one


    I currently have deliberate redirects set-up and running, other than some handled by the W3 Total Cache plugin… oh and I redirect all of my 404 errors using:

    ErrorDocument 404 /index.php?error=404

    in my root .htaccess.

    Try installing W3 Total Cache, see what happens? (I have run out of real ideas now!)


    In the article on askwpgirl it states

    Next, MOVE (do not copy) the index.php file that is in the WordPress application directory to the root directory.

    She goes on to say that you should make a blank index.php in the wordpress application directory, silence is golden


    In a text or HTML editor, open the index.php file that you just moved and change the location of your wp-blog-header.php to the new location.

    But in the codex it states that you should copy, not move…

    Conflicting instructions…

    Okay, so I followed her instructions because she claims the codex has it wrong. Here is what happens… the site works fine but if I go to I get a blank white page, and if I type in any page like etc. I get a blank page. I have redirection (not apache module) installed but nothing is getting redirected.

    So I fiddled, I tried restoring the index.php file in the wordpress install directory (so copy instead of move) making sure that the wp-blog-header path was back to original state.

    Now when I go to this gets redirected to and any pages like etc. also get redirected correctly. Redirections are working automagically…

    Great huh?

    Except… now I get a warning pop up in my firefox browser that says:
    The page at says:
    Ajax error

    You have to click OK in order to close this.

    So that is a problem that I don’t know how to deal with. I tried to clear my cache in wordpress super cache but that didn’t help.


    Found the ajax problem, it is a plugin.

    So to recap, the article at askwp that tells you to move, not copy index.php from your wordpress directory and then create a blank index.php in the wordpress root is wrong, at least in my installation anyway. Perhaps she is right if you are setting up from scratch a new wordpress install but if you are migrating an existing installation from a subfolder to root folder, it appears that you must copy not move as per the codex instructions.

    I am all squared away, my redirects work, my site works, just the plugin is broken and I will contact that author!

    Thanks to all who helped!

Viewing 15 posts - 1 through 15 (of 17 total)
  • The forum ‘Other’ is closed to new topics and replies.