How do I move WordPress from a subdirectory to the root directory?

Q. I’ve installed my website in a subdirectory of our domain, because I didn’t want visitors to see the site until I was finished with our development.

Now I want to have the site show up in the root directory (not in the directory). How do I do this? I’ve read the information on moving WordPress, and it seems really complicated.

A. The good news is that you DO NOT need to MOVE WordPress in order to have your content display without the subdirectory name. You only need to move 1 file and change one line of code and make one modification to your General Settings, and you’re good to go (see instructions below).

Installing WordPress in a subdirectory can be a good idea because:

  • It keeps your root directory clean and tidy (in case you need to add any other PHP applications to your site).
  • It adds a layer of security through obscurity by obscuring the location of your WordPress application files. Ideally, you want to name the subdirectory something not too obvious (ie don’t call it wp or WordPress). I’m not sure how obscure this really makes WordPress, because you can obviously get the subdirectory name from any images uploaded to the site, since they will still read as, so I usually install WP in a subdirectory for development purposes or to simply keep the root directory clean in case I install any subdomains or other applications.
  • It allows you to develop a new WordPress site while maintaining your current website in the root directory. Once you’re finished with your WordPress development, you can backup and then delete your current site’s files, and use the following instructions to display WordPress from the root directory of the site.

Note: If this is an older site, you will need to create 301 redirects to redirect your old page/post URLs to the new page/post URLs. Also, if you have a lot of internal hyperlinks, you will need to manually update those.

Before attempting to move WordPress

a) Clear ALL pages cached by your caching plugin cache AND then de-activate the caching plugin. Also, de-activate Broken Link Checker and any Redirection plugins;

b) Remove any old site files from the root directory — perhaps copy them to a folder called _backup – this includes an index.html file which will totally make this process not work. You MUST remove all those old site files and folders or move them into another directory, so they don’t interfere with WordPress. Having an index.html and index.php in the same folder causes confusion, and likely, the index.html will be used instead of WordPress’ index.php file;

c) Make sure you don’t have any other folders in the root directory that have the same name as any pages on your WordPress site, for example “blog” unless of course this is the name of your subdirectory install of WordPress in which case you cannot have a page of the same name because the browser will get confused and look for that page in that folder, then things are really confused;

d) Use wp-db-backup to make a backup of your database –;

e) Be sure you have access to your database via phpMyAdmin on your web host’s control panel in case you type the URLs wrong in the next step. Your database username and password are in the wp-config.php file.

Displaying WordPress URLs from root directory when WordPress is installed in a sub directory

1. Login to the WordPress Dashboard. From the Settings -> General tab, set your WordPress address URL to the subdirectory you installed WordPress in (without the trailing slash). Note: This will already be displayed in the WordPress address field, so you don’t have to change it. What you do need to change is the Site address URL. Set this to  your site’s root address (without the trailing slash).

2. Using an FTP application or your web host’s File Manager, DOWNLOAD the index.php file that is in the WordPress application directory (not the one in your theme’s folder or elsewhere) and then UPLOAD the copy you downloaded to the root directory. (By root, I mean the www, htdocs, or httpdocs folder — NOT the root of your hosting account! You simply want to upload the copy of the index.php file and put it in the parent folder of your subdirectory which presumably is the location for the main URL of your website.)

Alternately, you can use your FTP application and MOVE the index.php “to the parent” but then you MUST read and follow step 6 below.

(Note: If you have a site already in the root directory, such as an old static html site, then you should backup and delete those files first.)

3. In a text or HTML editor, open the index.php file that you just copied and/or moved to the root (aka main url) directory and change the location of your wp-blog-header.php to tell WordPress where it can find the WordPress application files in the subdirectory:

Example: if your WordPress installation folder is ‘mywp’, you would change:

require( dirname( __FILE__ ) . '/wp-blog-header.php' );


require( dirname( __FILE__ ) . '/mywp/wp-blog-header.php' );

Important: Be sure you type this correctly! A missing / or too many slashes or missing period or apostrophe can make this not work. Believe me, I’ve seen people be totally freaked out things didn’t work and it was because they typed this line wrong.

4. Visit the site and click an interior page to make sure it displays correctly. If it doesn’t, you may need to update your permalinks (Settings -> Permalinks and click Save Changes). If you still cannot access your interior pages, then the .htaccess may need to be moved to the same location as the index.php file (i.e. the root directory). This is not necessary on all web hosts. Be sure to update the permalinks again after you move the .htaccess file.

Remember that your login and registration links will still be

Now, when people visit your site, they will see all the URLs of all the pages and posts as if you had installed WordPress in the root directory, and you will have a neat WordPress directory behind the scenes.

Note: If the site you are redirecting to the root previously was your live site, and you have a lot of posts whose URLs you do not want to change, then you should change your Permalink structure to INCLUDE the old subdirectory name (e.g. mywp), so none of your post hyperlinks break. For example:


The /mywp/ will only be in the URL of the posts, not the pages.

5. Create a “Silence is Golden” index.php file in the WordPress directory.

If you copied the index.php file instead of moved it, this step is optional. Essentially, you don’t “need” this duplicate index.php file in the subdirectory because it doesn’t really do anything other than prevent people from reading the directory contents. However, if you moved the index.php file leaving the WP directory without an index.php file, then you should create a new blank index.php file and put the following code in the file:

[php]<!–?php // Silence is golden. ?–>[/php]


If you have any trouble with this process, please visit my Moving WordPress from Subdirectory to Root FAQ.


If this process was successful, please comment with a thumbs UP below, share on Twitter, follow me on Facebook. Thanks!!!

Angela Bowman

Front-end WordPress developer since 2007 building highly custom websites for nonprofits and small businesses. Experienced in nonprofit administration, grant writing, and technical writing. Love high altitude hiking and backyard chickens.

View all posts by Angela Bowman

957 comments on “How do I move WordPress from a subdirectory to the root directory?

  1. In case anyone is wondering if these instructions are still reliable in 2020…yes! Yes, they are. I just used these to make a WordPress installation located in a sub-directory live in the root directory, without moving all the files. It took me about 20 minutes.

    And I didn’t see any comments about this, but the client I did this for has a second WordPress instance in a sub-directory of their root, that they did not want changed. These instructions still worked and didn’t impact that instance at all. (I was concerned about this)

    I’ve been working with WordPress sites for about 10 years now, and this was like magic to me. Make sure you do all the steps to take backups of everything…just in case, but rest assured that these steps will still get you where you want to be.

    • I’m so glad to hear that. WordPress functionality has not changed at all in 15+ years in terms of where WordPress gets installed.

  2. thank you Angela, the article is very helpful. I managed to change the url of my website to the root

    however, I have one issue asking for extra help

    after I move my site to the root using above method, I failed to install ssl certificate.

    when I access http://mysiteurl, it is still working as per normal.
    however, when I access https://mysiteurl, it is shows an error “file not found’

    to ensure my web server (nginx) has the certificate installed, I did the following
    I access (which is my ip) via browser, then it shows an error that it is an illegal private connection, and further click the error information, it shows the certificate does not match and my certificate details are loaded. this is an expected error, because my certificate is while I am accessing the ip
    so it proves that my web server has installed the ssl certificate

    so how can I install the ssl into my WordPress site after moving the url to the root?

    btw, I used really-simple-ssl plugin, it did not work, so I did an uninstallation

    thank you in advance

    • Hi Jason,

      It’s been so long since you left this comment. Were you able to figure out your issue with SSL on the site?


  3. Clear, easy to follow instructions…. Only took a few minutes. Thanks! It’s so much easier than poking around .htaccess files!

  4. Hello,

    Thanks for this guide. But my issue is a bit different. I have a root domain that has content and gets traffic. Then I have a subdirectory for the root that also has content and gets traffic. Now I want to combine the two to make them one site. I want to transfer the posts and images of the subdirectory to the root as additional content. How do I do this successfully without losing SEO?

    Actually the plan is to combine the two to one but on a different domain. But I feel I need to first make them one on same domain before then moving to a new domain. Please guide me on this. I’m stuck.

    • Hi Karo,

      I’d recommend changing the main domain URL first, so that becomes the authority domain, then make sure to use .htaccess rules to redirect all the former URLs for the old domain to the new domain.

      You can use the Tools > Export option in WordPress to export all the pages and/or posts from the subdomain site and then use Tools > Import to import them to the new site.

      If the subdomain has SEO rank, keep it installed, but use the Redirection plugin to redirect the posts on the subdomain to the new posts you’ve imported to the new root domain.

      Sorry for the late reply. It’s been a crazy year.


  5. Hi Angela – this was brilliant, simple to follow and worked! Thank you SO much! However, everything appears to be working fine on the site, but I can’t edit any pages in Elementor? I’ve tried deactivating all plugins (except Elementor) and it still doesn’t work. Any ideas?

    • Hi Pete,

      Wow! That’s kind of crazy. Can you write to me privately via my contact form? Maybe I can check out the site.

      • Hi Angela, same problem here. All worked fine but Elementor stopped working. I even updated the URL on Elementor and nothing. Please help! Elementor’s editor is not loading at all.

        • Elementor does have a cache of its own. Have you tried clearing your browser cache fully? Also, de-activating and re-activating Elementor might help. I’d reach out to Elementor support to see what they say. All plugins should work as normal if they are coded properly.

          • Thanks Angela! I followed your instructions to make the site live on the domain root and they worked perfectly. Then I discovered a similar issue with Elementor being unable to edit pages and yet again you solved it – the key for me as you suggested was flushing the BROWSER cache (not the WordPress cache). For anybody else struggling, open your WP admin console in a different browser – if you can edit with Elementor there, then you know that you need to clear your original browser’s cache. Be well, all!

          • Hi Dan,

            Thanks so much. I have a few more tips for migrating Elementor which I will add which includes Regenerating the Elementor CSS cache and using the Elementor URL rewrites tool.


          • Hi All,

            Great tut Angela, have used twice now.

            I had the same issue with elementor today. I cleared all caches, deactivated/reactivated elementor and other plugins and no luck. Re-activated my license. Still no luck. Cleared my browser cache, no luck.

            I finally found a fix – I logged out of wordpress admin and logged back in.

            It works fine now. Hopefully it helps someone else with the same issue! Might be one to add to your FAQ?

          • Hi Cat,

            I’ll update instructions for Elementor on this tutorial. You do need to use the Elementor > Tools > Rewrite URL functionality, because Elementor URLs can’t be rewritten with the database URL rewrites unfortunately. It makes migrating Elementor sites kind of a pain. Also, after doing that, you need to regenerate your Elementor CSS under Elementor Tools as well.


          • This is a bit late, but the Elementor site says:

            If you replaced the domain of your website, you can go to:

            Elementor > Tools > Replace URL in your WP dashboard to continue working with Elementor from your new domain.

          • Hi Em,

            Thanks for pointing that out. I just started using Elementor a few months ago and am now a Global Team Leader. I will modify this post to include information about Elementor migrations as Elementor is not very friendly for any migration processes or tools as it has it’s own URL rewrites. I also recommend regenerating the Elementor CSS after doing the URL replace in the Elementor Tools.


  6. I’ve been using this method for so many years thanks to you. So much easier and better than all the other instructions on the web which basically tell you to move the entire site to the root. Thank you!!

    • Hi Paul, It’s amazingly simple and yet, I agree, really hard to find clear instructions which is why I wrote the post. I’m glad it was helpful to you. It seems to be my one-hit-wonder.

  7. Angela,
    I normally wouldn’t post here but your comments were so helpful. I want to thank you for this site. It was very useful. Pardon the following question as I am a NOOB. I followed your instructions and everything worked fine except that when I access my site remotely, I am using my phone not on the home wifi, the site shows up without the pictures and formatting. The text is there but it simply looks ugly. I am hosting the site myself and within the house when I connect to the computer in the house everything looks fine. I modified the php file as you said. I also ended up copying the .htaccess file too. I thought this would fix it but to no avail. The site is if you would care to have a look. I would appreciate any thoughts you might have. I am sure this is something simple, but I am very new to all this.

  8. Angela, thanks so much for your clarity (and your patience :)).
    I applied this procedure for many sites and it worked fine every time.
    But now i don’t Know if i can use same procedure in case when
    there is already a wordpress installation installed in the same way
    as you explained. I am going to lunch a new version of the actual site,
    I’ve installed this version in a subdirectory (/new), also the actual version of the site is in the subdirectory
    (/old). What’s the procedure to make display the new version of the site as
    it were in root folder instead of the actual site? Thanks.

    • Hi Mary Hellen,

      You can do this process even if there were a previous site installed the same way. Follow all the steps in this post, however, there will already be an index.php file in the public_html/root directory that you can simply edit as instructed in this post. Let me know if you get stuck.


    • It might be a plugin that is causing an issue. Sometimes caching and security plugins can be a problem. I would rename your plugins folder to plugins-old, then try to login to the site and visit the plugins page. It will show all the plugins de-activated. Then, rename the folder back to plugins, go back to the plugins page and take note of the plugins you have installed and activate them one at a time. If you are using Wordfence, let me know as that has special considerations and steps for “migrating” to new URL.

      If you have a caching plugin, you may need to delete old cached files. Let me know if you are using a caching plugin.

      Also, if your web host does caching, you’ll want to clear the cache there.

  9. Hi,

    I followed all your steps and everything worked perfectly!! Thank you SO MUCH! You really wrote everything perfectly and easy to understand. My site is live and it only took around 10 minutes to do so! 🙂 Thanks again!

    P.S. this was my first time making a site live, which shows you how well you explained everything! 🙂

  10. Hi Anglea, I have followed all your step closely and I get a HTTP ERROR 500, I have been through the FAQ page and still no luck. I must be missing something. I would appreciate any help you could give.

    • Hi Jayson,

      I would try to de-activate all your plugins by renaming your plugins folder to plugins-old and see if that gets rid of the 400 error. Then visit the plugins page in the Dashboard. You’ll see that all the plugins will be miss. Then rename the folder again and activate the plugins one at a time. Sometimes also switching to the default theme and then making the move and then re-activating the theme you want to use can help. Some plugins and themes are just not coded very well and can cause issues when moving, but then they will be okay after re-activating after the move.


  11. Hi,

    This will be my first time moving a site and making it live so I am not very familiar with some of the things you listed in your steps.

    1.) you said before I move my site, I have to use a caching plugin. Is this mandatory or can the site still work without caching it? Also, if I have to use it, do I just download a caching plugin like: into my site, cache it then go on with the rest of your steps to move my site? I’m just not familiar with the whole process of caching.

    2.) Like question 1, do I have to do the same for backing up my database (😉 ? if so, once I back it up, do I de-activate this plugin before I move on to the next steps?

    3.) Inside my FTP (FileZilla) when I go to download the Index.php file a box pops up saying “this file already exists, please choose an action, 1.) overwrite, 2.) overwrite if source newer 3.) overwrite if different size, 4.) overwrite if different size or source newer, 5.) resume 6.) rename 7.) skip”. Which action do I select? (also, I haven’t deleted my old site files yet, is that why this box is popping up? Plus whenever I get to download it, what folder does it get stored in so I can select it later?

    4.) In your step 2, you said after downloading the Index.php from the sub directory that I have to upload it to the root – www, htdocs, or httpdocs folder, are these folders the same as my “public_HTML” folder? I am using CPanel and my public_HTML folder is where the root domain is stored.

    • Hi Lea,

      I got your other message that it all went fine, and I’m a bit behind on my replies, but I wanted to reply so others would see the answers to your very good questions:

      1 – What I write in the post is to DE-ACTIVATE any caching plugins that you may be running. The point is to NOT have caching plugins active and to DELETE any cached files if there are any, as the cached files will pertain to the old URL and not the new one and will cause issues with any type of WordPress migration. Since you weren’t using a caching plugin, you don’t have to worry about this.

      2 – It’s always a good idea to back up the database before making any big changes to the site. You can de-activate this plugin before or after migrating or keep it active so you can setup ongoing backups. See my post on Backup Up WordPress:

      3 – That is interesting. I wonder if you had previously downloaded a copy of your index.php file to the location you are choosing on your computer?

      4 – Yes, the www, htdocs, httpdcos, and public_html folders are all the same. I need to edit that text! Thanks for pointing that out.

      I’m glad everything went smoothly.


  12. I followed the instructions and everything worked except the homepage, which was giving a “page not found” error and still trying to use the subdirectory url. I checked the theme’s header.php as well as the .htaccess files and couldn’t find any relevant code. I also used the broken link checker plugin and updated the permalinks, but also no help. (Also rechecked the require line in the index.php that I copied into the root directory.) Not sure what else to check. I’m hosted with if that’s of any use.

    • Hi Mitch,

      The home page link is set in Appearance > Menus. I think you’ll find it using a Custom Link with the old URL.


      • Hi Angela!

        Thanks so much for putting in the time to help everyone. I’m having the same problem as Mitch, and I tried your suggestion, but unfortunately to no avail. Specifically, for the home page link in Appearance > Menus, I tried using the root URL as well as the URL with the subdirectory.

        If you have any other ideas, I would really appreciate the help!

        Thanks again.

        • Some web hosts, like Network Solutions and, have a setting where they redirect the main URL of the site to a subdirectory when you install WordPress in a subdirectory. It creates such a challenging problem for people as locating this redirect in the control panel interface is like finding a needle in a haystack.

          If you are on one of these hosts, you need to go to your “My Installed Apps” are in the control panel and click “unset this wordpress my homepage” option. This will stop the home page from redirecting to the subdirectory.

          Let me know your URL and who your host is.

      • Update for others with this problem: I was able to get it fixed.

        I contacted my webhost, and in the control panel, he explained that I can turn the error log on/off. Sometimes, a change will be need to be made to the server configuration, and all that’s needed is to click “apply” to implement the changes. I don’t know the details, and I imagine it varies depending on the web host, but there may be a similar option on a lot of platforms. Apparently, it amounts to refreshing/rebuilding the vhost, but it only requires two clicks!

    • Hi Silver Darling, Thank you for saying so! I try! I wrote this originally for my students before their were instructions on I’m glad so many people have found it valuable.

  13. Hi Angela,

    Do you know if this step keeps the SEO as it was, or does something has to be done in maintain it?
    Furthermore, what setup would you recommend in order to have the best SEO?

    • Hi Terry,

      For this process, the URLs will change from having the subdirectory in the URL structure to not having it. Therefore, you would want to redirect the old URLs to the new ones to maintain the SEO rank of those posts/pages. The easiest way to do this is using the Quick Page/Post Redirect plugin:

      You will enter the old URL in one field and the new URL in the other field. You will do this for each post and page on the site.

      This creates what is called a “301 Redirect”. Here’s the definition from

      “301 Moved Permanently. A 301 redirect is a permanent redirect which passes between 90-99% of link juice (ranking power) to the redirected page. 301 refers to the HTTP status code for this type of redirect. In most instances, the 301 redirect is the best method for implementing redirects on a website.”

      I’m not sure why the 90-99% range is there. I’m assuming that the potential loss of 10% is related to people potentially doing 301 redirects to non-identical pages or other factors related to the content that effect the link juice passing down.

      Removing the subdirectory from the URL structure, I think, can only help, because it simplifies the URL which makes it more friendly overall and not cluttered with meaningless keywords (ie your subdirectory name).

      Good luck!


      • Thank you Angela for your perspective.
        I have just attempted to perform this simple solution but unfortunately, it didn’t work for me. My homepage shows correctly, but my inner pages do not load. I have moved my htaccess file and used the content wordpress generated for me, but to no avail.
        I think I will try a physical move, as there’s not really anything else on the root folder.

        • I’m glad moving the site worked for you. Usually when this process doesn’t work, it’s due to a typographical error made during the process.

  14. Hello,
    I cant find the: WordPress Address URL, and Site Address URL under Settings—General. Is it because of my version of WordPress (version 4.7) which is the latest version? Pls where did they hide those options?

    • Hi Martin,

      If you are using WordPress multi-site, these settings will not be available under Settings > General.

      Do you know about how the site was set up? Do you have Administrator privileges?

      If someone hardcoded these settings into the wp-config.php file, you will not see them in Settings > General.

      To check the wp-config.php file, you will need to login with FTP or SFTP or the web host’s Control Panel and edit the wp-config.php file and look for these lines:


      Let me know what you find!


      • Hi Angela,
        I need to do exactly what this article is doing, but for a multisite installation that is currently installed with PATH_CURRENT_SITE,’/main/’ and I want it to be just ‘/’. Any ideas? (I have a redirect in root now)

        • Hi Pol,

          In this case, you need to move the install to the root directory. This is slightly more tricky with multi-site than a regular site but the concept is the same. See my instructions here for MOVING WordPress to the root directory:

          I would make a backup of the full install before proceeding.

          Before doing this on the live site, I would use another domain that you don’t use right now, maybe something you purchased and never got around to using, and set up the exact situation as you have now with some dummy content and dummy multisite installs, then try the process in the link above and see if it works! Here are a few more tips on moving a multi-site install:

          Let me know how it goes!


  15. Great article Angela!

    I will use it this week for my new site, I have 2 questions.
    1) I am running Wordfence premium security; I was wondering if I have to turn this off while doing this?
    2) I am a little worried about the following “Also, if you have a lot of internal hyperlinks, you will need to manually update those.”. Can you explain to me which links will work and which links will need to be changed manually after this? I assume it are all the text links in the pages? I am using Divi, not sure if this makes a difference. And what about all the buttons and links in images I have? I have many pages…


    • Hi Gijssio

      I would definitely turn off caching and your security plugin before doing this process. Clear the cache and then de-activate. You will need to reset your cache settings after the process as all the URLs will have changed for the pages/posts.

      As for Divi and internal links, I would do a search on the Posts list page (Posts > All Posts) and the Pages list page (Pages > All Page) for the old URL to the site, then edit any buttons manually to the old URLs. I hope there are not too many. It’s hard to do a global search and replace because upload images and files will still reference the URL with the subdirectory name in it.

      If you would like to actually MOVE WordPress to the root directory, I did write instructions for that process here:

      This process is a bit more involved.

      Good luck! Let me know how it goes.


  16. Dear Angela, marry x-mas and thank you for being such a great help to so many people. I wonder if I would be allowed to bother you with my question. I installed wordpress as n00b and ended up having my multi-site like this:,, May I ask if you know of anyway to mask the /wp/ part of it?

    In this article you commented somewhere that the presented way cannot be used for multi site, hence my question.

    Thank you so much!

    • That is going to be impossible as the install files are in the wp folder, so any attempt to rewrite the URLs will also make the WP files not work.

      In this case, you need to move the install to the root directory. This is slightly more tricky with multi-site than a regular site but the concept is the same. See my instructions here for MOVING WordPress to the root directory:

      I would make a backup of the full install before proceeding.

      Before doing this on the live site, I would use another domain that you don’t use right now, maybe something you purchased and never got around to using, and set up the exact situation as you have now with some dummy content and dummy multisite installs, then try the process in the link above and see if it works! Here are a few more tips on moving a multi-site install:

      Please keep in touch, Matti, and let me know how this goes!


  17. Hi to all,

    You can leave the site exactly where it is and just tell WordPress what you’ve done by making a few changes to settings and minor edits to a couple of files. It just takes five minutes or less.


    • Hi Chris, Yes! And that IS exactly the process I describe in this post! It is easy, and it takes 5 minutes. Sometimes people skip a step or make a typo, so these instructions and the FAQ help people check their work and make sure they did the simple process correctly. Most people do. Did you have a chance to read the post to see that this is the process I am describing? Maybe you commented based on the title of the post and didn’t realize I had written what you described. ~ Angela

  18. Thank you very much for your post. Very informative, and it worked like a charm. However, I’m having admin-ajax.php issues. We moved our site from to, and we are receiving the following error message on the page (none of the lightboxes are working):

    I tried to create a robots.txt file with the following:

    User-Agent: *
    Allow: /wp-admin/admin-ajax.php

    and placed it in my root directory, to no avail. Any thoughts?

    Thank you.

    • Hi Coiski,

      We conversed via email, and I’m trying that everything is working fine now. Glad you wrote to me!


  19. Thanks for the tips, Angela! I’ve followed your procedures above and all seems to be working fine. One thing that I’ve noticed is that Google searches of keywords where I know our site will show up, show the actual path of the page (, versus the “alias” path ( Any idea how to prevent Google from showing this?

    • It sounds like Google had indexed the old pages of the site which will now show as 404 errors. In this case, you will want to use the Quick Page/Post Redirect plugin to enter redirects for the old page to point to the new pages:

      In a few weeks, Google should then be indexing the new pages. You’ll want to do the redirects, though, because you don’t want to use your Google page rank on these old URLs. By doing the redirect, you are transferring the keyword value of the old URL to the new URL.

  20. Thanks for this… I had done all the steps except removing my old index.html file from root, from a previous incarnation of the site — moving that file out was key, so thanks for the tip!

  21. Great advice here, thank you for taking the time to share!

    On a loosely related topic, what method would you recommend for maintaining a mirrored “dev” version of a site for testing purposes? I’ve got a decent amount of experience doing this with HTML5 sites, but I’m relatively new to WP and the trouble I’m having is with licensing/activation of paid plugins & themes on the “test” site versions.

    I have to imagine this is a relatively common practice; if you have any advice on how to maintain a mirror site effectively, I’d greatly appreciate it!

    Thanks in advance!


    • Hi Kirk,

      I think that would be a great topic for a blog post. There area a few approaches:

      1 – Have a local copy of a site on your computer using MAMP, XAMP, or my favorite DesktopServer. DesktopServer works on both Mac and PC and allows you to create development environments with the click of a button. After you create the site, you can then “deploy” it to the web host. Once it’s one the hosting account, you can do one of three things:

      a) Use the local copy for testing updates, coding changes, etc. If it’s all okay on the dev site, then “publish” or “push” the changes to your live site. Using a coding application like Sublime, Coda, or Brackets allows you to sync via FTP to your production (aka live) site with the push of a button. So you test locally, then publish using your integrated development environment application (e.g. Brackets, etc).

      (When I say “push,” I am referring to using Git repository to do version tracking on your changes. It’s great for more complex sites and working in team environments, but it has a big learning curve. You can learn more about that here:

      In this first option, you would not necessary keep the database synced, which is typically NOT super critical when testing most updates and changes. The content on the production site will differ from what you have on your local staging site, but all the core, theme, and plugin files will be the same.

      b) Use the local copy as indicated above but keep it in sync with the database. This is a bit more complex and challenging to set up, and you have to consider how to get production site changes that effect the database back to your local site, so you don’t overwrite live site changes with your local copy. Honestly, even though I use Git workflow on some sites, we do not sync the database content. It just hasn’t been necessary. However, if you are interested in this process, Sridhar Katakam wrote an in-depth tutorial on it here:

      c) Use a web host such as Site Ground, WP Engine, or Get Flywheel who provides staging environments as part of their services. You can quickly copy the live site to staging, test changes, and either push the staging back to live or just repeat the changes you’ve tested on staging on the live site. They often offer the options of just pushing the file changes and not the database changes which is handy if the production site is very active with publishing, commenting, e-commerce, etc.

      I hope this helps point you in a direction. I can’t recommend DesktopServer highly enough. It’s very liberating and saves tons of time. Even if I don’t keep a perpetual local copy of client’s sites, I can easily duplicate their site using the Duplicator plugin and import it into DesktopServer to test certain plugin and theme updates I think might need carefully checking before repeating the process live. On my larger client sites, I am using Git and a perpetual QA environment, so I go from local to QA to production. Much more time consuming but less likely to break anything on production.

  22. It’s really a nice and helpful piece of info. I am glad that you just shared this useful information with us.
    Please keep us informed like this. Thanks for sharing.

  23. Hi – Everything went fine – except now when I click on the site logo (which usually brings you to the home page) I get a Page not found 404 Error., Can you please tell me how to correct this issue?

    • Hi Will,

      If the logo link isn’t working, it might be in your Theme Options. Check there where you set the logo up as I imagine that is a field you will have to manually change.


  24. Great article, Angela. But let’s say I set up a WordPress site under a subdirectory for a client, they’re happy with it, and now they want me to move the website onto THEIR webspace. How would I go about doing that?

    • Hi JerY,

      Great question, and the answer is: Use the Duplicator plugin! It works awesome. I’ll write a post on this. Essentially, this is called a “site migration.” The Duplicator plugin will zip up the entire site. You will download the Zip file and the import script it provides and upload to the client’s public_html directory (copy their old site into a folder for safekeeping — if all works well, download and then delete their old site).

      On their web host, you’ll use the MySQL Wizard to create a new, blank database.

      From the web browser, you’ll visit their domain /import.php – This will launch the Duplicator script you uploaded, unstuff the archive, populate the database, rewrite the URLs to their domain, and you are done!

      They have a great video tutorial at:

  25. Hi Angela,

    I am running into a bit of trouble, it would be amazing if you could help/guide me to fix this issue.

    So, initially there was a wordpress site already installed in the main folder called WP. so the structure goes like” /WP”, where “/” is the root.
    So then, I created a subdomain called which lives in the directory “/dev”.
    So meaning there are two folders in the root folder: “dev” and “WP”

    So I have completed developing the new site on the dev subdomain and now I want to make the main domain (ie. point to the /dev folder instead and run off that new wordpress site.

    I have followed your steps and did the following:
    1. Logged in to my subdomain’s wordpress backend and went to Settings -> General, and changed the WordPress Address (URL) from to and changed the site Site Address (URL) from to Then I clicked “Save” and then I could no longer access, as it automatically redirects to now.
    2. I logged in via FTP and downloaded the index.php file from the WP folder and then made a copy of that and then edited it and changed “require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );” to “require( dirname( __FILE__ ) . ‘/dev/wp-blog-header.php’ );”
    3. Then I placed the index.php file in the ROOT directory so its in the location: “/index.php”, so this ROOT directory is the parent of both “/dev” and “/WP”.
    4. When I go to, it still points to the old site and does not point to the new site in the “/dev” directory. I can now no longer access the anymore as it redirects to the main url and I am freaking out!!

    Please help!!

    Thank you very very much,


    • Hi Cullan,

      Yes, this is a bit of a mess and not a recommended process.

      Here’s what you can do to fix it:

      1 – Move all the files out of the dev folder and into the public_html folder (remove any non-WordPress files from old sites).

      2 – Login to phpMyAdmin in your web hosting control panel and edit the site and home URLs in the wp_options table to be

      3 – Login to the site and run the Velvet Blue Update URLs plugin to change all the URLs on the site from:

      Be mindful of the slashes and be consistent.

      That should fix everything.


  26. Hello and thanks a lot for your help, this article was godsent!! One quick info since I ran into the problem, my permalinks were the type that include the name of the article and that added an extra step, when updating the permalinks I actually had to change the permalink settings to “simple” save them, and then change them back to “name of the article” for the website to be running.
    Hope this helps if anyone needs it!
    Thanks again and take care

    • Yes, sometimes toggling the permalinks to default then back to your preferred structure can force them to rewrite.

    • Hi Helix,

      If you have a web.config file that means that you are on Windows hosting, so that replaces .htaccess to allow pretty permalinks to be used.

      What you will want is to not have the subdirectory name in the web.config file. Ideally, it should be in the same folder as the index.php file, i.e. the public_html folder or equivalent.

      Try that and let me know what happens.


Leave a Reply

Your email address will not be published.