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 http://mydomain.com/wordpress 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).
- If you feel a strong need to actually MOVE the WordPress installation from the subdirectory into the public_html folder, I’ve written instructions for moving WordPress from the subdirectory to the root directory here.
- If you installed WordPress in a subdomain (e.g. you can view the site via an address like http://dev.askwpgirl.com instead of https://askwpgirl.com/dev), then please see Moving WordPress from a Subdomain to a Root Directory instructions. They are similar instructions by slightly different.
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 sitename.com/subdirectory/wp-content/uploads/image.jpg, 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 – http://wordpress.org/plugins/wp-db-backup/;
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' );
to
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 http://www.yoursite.com/mywp/wp-login.php.
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:
/mywp/%postname%/
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]
Problems?
If you have any trouble with this process, please visit my Moving WordPress from Subdirectory to Root FAQ.
Success?
If this process was successful, please comment with a thumbs UP below, share on Twitter, follow me on Facebook. Thanks!!!




Hey this is brilliant, however i have another question
i have a wordpress installed in a subfolder and i have an HTML file in the root which contains flash site, i then i have a link in there which points to the wordpress site which is in the subfolder
i want to be implement this same thing as above while maintaining the flash site in the root
is it possible
Thanks
Antony
Hi Antony,
That’s a great question. So, you want to display all the WordPress URLs from the main URL but keep the Flash in the root, correct? The main issues I would see with this are:
1 – Is the Flash file invoked via an index.html or some sort of index file that would conflict with the WordPress index file?
2 – Is the Flash file the landing page for the domain? If it is, then having the WordPress index.php file in the same directory may conflict.
3 – You said the Flash site points to the WordPress which is in a subfolder. If you resolved 1 & 2 above, then you would need the Flash link to point to the new URL for the WP page you are wanting it to go to after following the steps in my post.
You could certainly backup your WP site using a plugin like BackupBuddy (https://askwpgirl.com/go/backupbuddy.php – my affiliate link) and then try the steps in my post and see if it works. Not knowing the name of your Flash file and whether that is the home page of the site is a bit tricky. However, being a resourceful person, I would follow the instructions in my post, then create a blank php page template within WordPress (eg page-flash.php) and assign this page template to a new page in WordPress called “Home” or “Splash” and choose this as the Static Home Page under Reading Settings. In the page-flash.php template, I would put the code to launch the Flash.
If you don’t know about creating custom WordPress page templates, this might be Greek to you, but it would be one way to keep the Flash functioning and WordPress at the same time from the root, by incorporating the Flash into the WordPress install. It won’t change the look of the Flash, it will just make it behave from a URL standpoint properly by being an object on a WP page (that is — a totally blank WP page so it doesn’t disrupt the look/layout of the Flash).
thanks for your response
Hey the flash file is evoked using the Default.html file, which has precedence over Index.php right ?Yes the Flash is the landing page for the Domain, the landing page has an enter here which redirects to the wordpress site, the URL for the link is given as wordpress/index.php
so i should be able to do your procedure as long as i have the landing page as default.html and of course i have to point the enter here to /index.php right ?
if you want to have a look at the site here it is
http://shalimarthailandplants.biz
I’m not sure if the default.html will conflict with the index.php. I think it will, that’s why I would personally create a page in wordpress called “home” or “flash” and make this the default home page for WP under General settings, then create a custom page template that basically has the contents of your default.html page on it. If you want to hire me to set that up for you, I could.
you might be right, i default.html does conflict.
i am going to try the custom page template, if i fail i shall get back to you.
thanks WPSupergirl
great tutorial, thanks!
Thank you soooooo much! I have followed your instructions and all worked well except I can’t get the home page navigation link to work. Have installed plugin, looked over code and still can’t make it happen. Any thoughts would be very much appreciated. I was in Boulder for the last Word Press Camp there. Enjoy your day, Bob, up the road in Lander, Wyoming
Hi Bob,
The home page link is either set in your theme’s header.php file OR more likely under Appearance > Menus. So you probably want to remove the Home like you created previously for your custom menu and add a new custom link to the home page and save your menu.
This is exactly what I need to do, except when I try to do it, I am getting the following error when I load the main “mysite.com” page:
“Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/hihp0312/higherhopechurch.cggc.org/index.php on line 17
Fatal error: require() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/local/lib/php:/usr/local/php5/lib/pear’) in /home/hihp0312/higherhopechurch.cggc.org/index.php on line 17”
There was a previous Joomla installation and there is no www, htdocs, public_html, or httpdocs folders that I have unearthed after hours of searching. I thought I had the file in the right root directory, but perhaps I don’t. Any help you can provide would be immensely helpful. Thank you.
Hi Jen,
You may have missed a step. Please read the FAQ for this blog post and check that you edited the index.php file correctly after you moved it to to the public_html directory. Please reread the instructions carefully. The error you are getting is related to the index.php file not finding the folder in which you have WordPress installed, and the require line must be edited correctly according to the instructions in the post.
this is still very complicated, compared to what was said about moving one file, one line of code and one modification! I might need someone to hold my hand while I do this because those instructions are foreign to me lol
Thank you very much! This is exactly the information I was looking for!
THANK YOU, THANK YOU, THANK YOU!!! If it weren’t for passionate individuals such as yourself… where would we be???
🙂
Your assistance has been greatly appreciated!! Bonnie
Hi,
Thank you for the above instrusctions. They’re detailed and will certainly assist me. However, I seem to have ‘lost’ my old static site. It’s no longer in the public_html folder but somehow is still live. 🙂 help!!
Thanks
Bonnie
I don’t know what you mean be “is still live.” Does that mean you’re finding it in a Google search or you see it when you visit the site in your browser window? Have you tried deleting your browser cache? It will take a few weeks for Google to re-index your site and no longer show the old page URLs. It helps if you install the Google XML Sitemaps plugin and submit the sitemap via Google Webmaster Tools.
On my win2003 server with PHP5, I was getting a white page for my blog until I changed the line in the index.php file at the root of my site (not the index.php file in the blog directory) to the following: Note the deletion of the “./” right before “mywp”. It’s working great now.
Your text got cut off in the comment, so I don’t know what you changed your index.php file to, but yes, you are supposed to edit the index.php file in the root of the site not in the sub directory. The copy of the index.php in the subdirectory doesn’t have a function after this process has been completed other than to prevent reading of that directory.
I have never seen the index.php work properly without the ./ before the sub-directory name. That wouldn’t make sense in a normal hosting environment. Here is what the require line is supposed to look like (where blog is the name of the subdirectory):
‘./blog/wp-blog-header.php’
So, interesting that yours is working as:
‘blog/wp-blog-header.php’
on your server. I would think that would break it unless there has been a typo to begin with. I don’t know anything about Windows server hosting. I usually recommend people avoid hosting their WP on Windows because it usually results in a lot of problems, including difficulty with permalinks and plugins.
I have been looking for an answer for my question and I think I found it or near enough but need some clarification first. Right now I have a static html site that I host on Hostmonster and currently use WordPress for my blog so it’s already installed. I would like to remove all the old files and create a new website in WordPress (all new pages, nothing from the old site will be kept) but keep the blog content as my blog. I have installed a new theme and am ready to design.
When I am ready for my website to go live I will remove the old html pages from the root directory, follow steps above to move WP from sub to root directory and deactivate the maintenance plug-in. All things being equal everything should be cool. Since I am moving WP to the root directory will my blog still be my blog and my website be my website on the WordPress platform? Or do I need to do other steps?
Hi Grace,
Is the only WordPress you have installed the one in the sub-directory? It sounds like you might have two WordPress installations. Please let me know then I can advise you.
The easiest thing would be to just use your current blog WordPress installations and create the static pages on that installation of WordPress using the new theme, etc., but then, if you’re using the maintenance mode plugin, people won’t be able to see your blog. That’s why it sounds to me like you are working with two different installations of WordPress.
I think you might be right. Under the public_html there is a blog folder that includes wp-admin, wp-content and wp-includes.
In the public_html/RedBarn-Studios folder (where my current & soon to be old website files are) there is another folder called blog_2. If I remove this whole folder (RedBarn-Studios ) completely I assume that the blog pages I have designed will be deleted as well?
Hi Grace,
I don’t know how to advise you at this point, since I don’t know which WordPress install is being used for your content, and it actually sounds like you have 3 copies of WordPress installed. If you want to hire me to sort this out for you, I can be reached at http://moongoosedesigns.com. Do you have two or three WordPress logins you are using – one for each of the sites? If you do, you need to pick the one you will ultimately be using for the live site, and login to the other one that contains your posts and go to Tools > Export and export all of your post content and then go to Tools > Import on the version of WP you want to use when you’re all done with your development and import those posts, so you have everything in one place. Don’t delete anything until you’re positive you have ALL of your content in the correct WP install. I have seen people do this before. They sort of get carried away with the one-click installers at their web host and forget all the places they’ve installed WordPress as they attempt to development work on a new site.
Awesome. I never knew it would be so easy 🙂
Angela – as always, thank you for your simple instructions
I was able to get this to work on a site of mine before, however, the WordPress contents interfered with some ASPDotNetStorefront contents, so it was either/or (by switching out .htaccess files)
However, we have now MOVED all of our ASPDNSF contents to a subdomain/subdirectory “store”, and the root is completely clean except for 4 directores
And now I want to complete my original intention of having my WP contents show up as domain homepage and normal pages
I got the homepage to load, and nav links are written correctly (without the /subdirectory/ showing in the link)… BUT I get the “”The system cannot find the file specified”” error when clicking onto navbar links to inner pages
I made sure to MOVE .htaccess over from subdirectory to root, and to re-save my permalink settings, but no go
Im thinking it has to do with me not doing exactly how I first tried (when successful) and possibly regarding COPYING vs. MOVING the index.php file and/or the .htaccess file
Just to be sure, I am supposed to essentially have TWO index.php files, one at root and one inside subdirectory where all wp contents are… correct? and with that, should those index.php files be identical? Im guessing they shouldn’t since your instructions say to download original, edit, then upload edited to the root – so it should be like this right?:
index.php in root should read:
require(‘./blog/wp-blog-header.php’);
index.php in subdirectory should read:
require(‘./wp-blog-header.php’);
I also tried the Silence Is Golden index.php within the subdirectory – still no go
I also tried having the .htaccess file BOTH in the root and subdirectory, made sure to update permalinks settings. Nothing.
Any ideas?
It might be something entirely different, being as this is a clients site hosted on a Windows host (booo! but he is running .aspx so must)…might be something else interfering
However, I was able to get it to work BEFORE, when the aspx stuff was at root, so I figured that after moving it to subdomain and root being clean as a whisle, that the WordPress would work perfect
thanks so much for your input
Hi Jesse,
Are you hosting on a Windows server? It sounds like you are if you’re also hosting an ASP store. If you are on Windows, you will need to contact your web host about how to manage the permalinks, because .htaccess with the rewrite mod is an Apache server function, not a Windows server function. If you read my FAQ which is linked at the bottom of this post, I do have some info about Windows permalinks on there.
found it further down on your blog. my .htaccess file wasn’t writable and I had to save it manually. i all works. thanks for your WP mojo!
Thank you for these tips! I moved everything over and followed your instructions. The landing page loads fine but the interior pages are not showing. I move the .htacces file to my root. I opened up my .htaccess file and there’s nothing in it. It’s file that was installed with WP by my host. I guess there should be some redirection code in there but I’m not sure what if anything. Thanks for any light you can shed on this.
Thank you for your prompt response.
After a bit of googling I found the relevant WP Codex page (http://codex.wordpress.org/Linking_Posts_Pages_and_Categories) to say “If you have installed WordPress to a subfolder, such as wordpress, don’t forget to add the folder to the link URL”. That is precisely what I have had to do, so perhaps I’m stuck with it!
Cforms survived the procedure with no problems despite your dire warnings. I’ll investigate further about the password plugin, but maybe I’ll have to abandon that one.
Many thanks; great post!
When you follow these procedures, the URLs for categories, posts and pages do NOT include the subdirectory. However, when WP is installed a subdirectory, as I wrote before, all of the images and uploaded files DO need to include the subdirectory in the URL, because the wp-content folder has not moved — it is in the subdirectory.
I should add that for people who follow these instructions precisely from the beginning and haven’t done other things previously to change the links on the site, then they do not have to worry about any links being broken, except for manually created internal links to pages or any custom links in the Appearance > Menu.
Thank you! After hours of trawling through numerous over-complicated instructions and laboriously undoing all the changes I had made when they didn’t work, I came across your clear instructions which made sense, and worked first time. However, I still have a couple of problems………
My links to uploaded media files such as pdf files were broken and I could only get them to work if I manually re-inserted the subdomain name into the link realtive URL. This worked, bit is there another tidier way to restore these links?
More importantly, in my subdomain I had a plugin called Exclusive Password Content Protect which hides certain content unless a password has been entered. The password entry box still shows, but entering the correct password achieves nothing. Any suggestions?!
Hi Henry,
Not knowing what you may have done or not done to break your links, I can only say that:
1) This process will NOT break ANY image or uploaded file links.
2) If your links are broken, it’s because of something you tried to do previously to “move” WordPress and perhaps rewrote your links in that process.
3) If WordPress STILL resides in the subdirectory, then all of the images and uploaded file links should still contain the subdirectory in the URL, eg.
https://askwpgirl.com/subdirectory/wp-content/uploads/mydocument.pdfAs far as the plugin again, the same applies there — it should work fine but some plugins don’t have the paths defined correctly and insist on looking for WordPress in the site URL rather than WordPress URL, so that would need to be changed in the PHP code of the plugin if that’s the case. You can Google that plugin and see if people have issues running it from a subdirectory. Cforms has this issue as well.
Please disregard my last question about the index.php file. I found the answer, I was looking at the wrong index file before. Thank you.
Yes.
Hi, I am working on a new wordpress site that I will eventually move to my main domain name to replace my old static site. Your instructions on moving it are very helpful, except I have one problem: I can’t find the line any where, on my index.php or on any of the index.php files that are with some of the included themes. What do I do or where do I find this?
Hi Christopher,
I use HostGator a lot. The issue with the .htaccess is easily resolved by going to Settings > Permalinks and clicking the Save Changes button. This automatically rewrites the .htaccess file after you’ve done the “move.” This is not a HostGator specific issue. It’s more that sometimes your .htaccess needs to be rewritten and the simple Save Changes on the Permalinks page will do that on good hosts such as BlueHost and HostGator.
Good to know about the Silence is Golden Guard plugin. I assumed it created an index.php in the WP directory, but if it doesn’t then I shouldn’t recommend it here and instead people should just download the blank index.php file from the wp-content and upload that into the WP directory — or WordPress recommends copying and not moving the index.php that’s there.
You have the site installed in a subdirectory and when you to go the root URL you want it to REDIRECT to the subdirectory, so you really DO NOT want the URLs to display from the root, you want them to all display from the subdirectory and when you go to the home URL you want it to show the subdirectory not the root URL? Correct? If that’s the case, return your Site Address (URL) back to how you had it with the subdirectory name and then use .htaccess at the root to redirect the root URL to the subdirectory.
You are doing the opposite of what most people want to do, so you should not follow any of my instructions in this post and instead leave everything in the subdirectory and use .htaccess redirect the root URL to the subdirectory URL.
Most people want to get rid of the subdirectory in the URL and show all the links from the root, so that’s why my post is not helpful to you.
Hi Angela, I have a different problem that I hope you might be able to shed some light on? When I first installed wordpress I did so on a subdirectory. Thinking I knew what I was doing I then copied this folder to my root to make this my websites directory. As your post so eloquently illustrates this did not work. So I resumed using the subdirectory as the root of the site. The site has grown in time and uses many plugins. I now want to consolidate the site and get rid of the extra files that were made by my previous attempt. The thing is, the site seems to use some of these files. So when I delete these extra files on the root of the server it breaks the site, even though the sites root is in a subdirectory. Is there a way of finding out which files the site is using in this directory, so that I can consolidate the site and then move it using the method you have written?
Either the site is in the subdirectory or it is in the root. Now you say you have files in both the root and subdirectory. That doesn’t make any sense. WordPress will look in one location for the files, so you should check your Settings > General in WordPress and see what those are and write back. Also, see what is in the index.php file. Why are there any files in the root if you moved them all back to the subdirectory?
i want to have my site which is installed at http//www.optimasystems.ca/security_division wordpress is installed in this location as well as my theme. it works prefectly but i want it so that when you type http://www.optimasytems.ca it shows the new wordpress site in the security_division folder
Your instructions seem so simple but i keep getting
this:
Not Found
The requested document was not found on this server.
so i changed the index.php file to this
———————————————————
this index.php file is a copy which was in the folder security_division
i also changed my general settings to:
WordPress Address (URL) http://optimasystems.ca/security_division
Site Address (URL) : http://optimasystems.ca
so i belive thats all i have to do but it’s not reading anything.
i have the old site up and changed the index.htm file to indexold.htm just so it wouldnt get confused . i put it back because the owners woulud freak if they see no site up.
Thank you for this post. I carefully followed the instructions and got it mostly working first time. I was using it to convert an old static site into a WP site, and I wanted to learn how to install WP in a directory.
My problems came from the fact that I use Hostgator. The site would not work internally with WP generated .htaccess file not in root (public_html). But when you move it to root it still has the reference to the installation folder in it. I edited in TextWrangler and uploaded it to the WP subfolder then copied over the top of the generic .htaccess that is created by the hosting. Bingo, everything worked.
I tried the silence is golden plugin, I must be dense because I could not get it to create an an index.php for the the WP folder, but it seemed to create one everywhere else. I ended up just doing in TextWrangler and uploading using my host’s file manager program.
Overall, a good experience, and I think I will do all my WP fresh installs in directories, not in root. Thanks.
than you so much, this guide just saved my day
Yippee!
Excellent, straightforward steps. Something I was worried would cause me a headache was completed in a few minutes thanks to these instructions.
Yes, any other method is painful for sure.
You are a life saver…so far! I’ll check back in 10 minutes to see if it’s still working…
Your directions are VERY COMPLETE and easy to read. Thank you!–Ana
Cool. Fingers crossed!
PERFECT! Easy to follow instructions that Ditto shannon.
I do have one issue, which began on my first attempt at this from another person(ugh) None of my images are showing up. The place holder is there and the link at the bottom display the original path to the image but no workie 🙁 Any suggestions?
Hi Maria,
It’s hard for me to say what the problem might be because of someone else having gotten in there, and we don’t know what they did. You can read the FAQ I wrote on this process, but I’d probably need you to send me the URL to the site, so I can see what’s going on. Are you still accessing WordPress via the sub-directory? What are the URLs to the images?
Thank you so so much! This saved me so much time and now I am going to create all of my sites in a subdirectory. Do you know if I will run into any problems in I install a wordpress landing page in the root, and then delete all those files before I go to move the fully developed site from the subdirectory to the root? Thanks! I’m off to make a donation for your excellent help!
Hi Kimberly,
Thanks for the donation! You can use one of two plugins (see below) to create a temporary “landing page.” You’ll want to follow the instructions in this post first, though, so the landing page plugin works. Otherwise, it will just show up in the sub directory.
When you’re ready to go live, you’ll simply disable the plugin.
http://wordpress.org/extend/plugins/underconstruction/
http://wordpress.org/extend/plugins/custom-coming-soon-page/
You can try them each out and see which one you like better. I think they each allow you to specify a custom-designed html page or have options for styling their landing page.
Thanks so much for that advice. I will take that into consideration on future creations. For my current site, however, I already installed a landing page plug-in at the root (along with a wordpress install), but I am working on my actual site on a subdirectory. I’m wondering, is having an install of wordpress at the root going to cause any problems when I go to make the transfer? And do I just delete all the files in the root at that time to make the transfer? A little clueless. LOL.
BTW, your advice from this blog post worked beautifully for a site I was just working on for a client!
You are so smart! For the site where you have WP in the root and WP in subdirectory, you’ll want to delete the WP in the root and then follow the steps in my post.
You might have to go to Settings > Permalinks to save those again so the .htaccess in the root gets reset properly.
Glad everything worked out with the other site! The only problems I’ve seen are with extenuating circumstances — such as Windows hosting server, mistakes, and people leaving their old files in the root.
I’ve got a lot of subdirectories on my site for forum and CMS applications and had previously linked to these from a static webpage in the root directory. This is so much easier and neater. I like the clarity of your instructions and the layout of the site.
Thanks for your work.
Yes, when you have lots of applications, it’s important to keep the root directory clean! Thanks.
You’re truly amazing. Thank you.
You’re welcome. I guess it worked!
All I can say is… THANK YOU! I must have read every tutorial on this topic over the past three hours and no matter what I did, I couldn’t get it to work until after reading yours. It was your well-written, highly-stressed #FOUR tip that solved this problem for me. Because I named my sub-folder wordpress like so many people do, I was actually changing the /wp to /wordpress, instead of just adding it in front of the slash. Blame it on my tired eyes or maybe not paying enough attention, but you spelled it out so beautifully and made it easy to see what I was doing wrong. This was my first time designing a WP site to take over a client’s static html instead of starting from scratch, and I was already a little nervous about the process. With this info I will definitely be leaving the WP files in a sub-folder from now on to keep things nice and neat. Thanks again for making it seem less scary! I will be bookmarking your site to follow for the future! :o)
Hi Shannon – That was the best written testimonial I’ve received yet! I’m glad that the highly stressed #4 was helpful. After receiving hundreds of comments on this post and helping people personally do this, I’ve rewritten the post plus wrote an FAQ, because I would see the same mistakes over and over again. It’s those simple things – like syntax – that can make things go wrong. I’m guilty, too, of “tired eye syndrome” and simply having a misplaced ; or ‘ in my code. Good luck! I’ll be writing more helpful posts over time.
Hi from Denver 🙂 I really appreciate your knowledge of WordPress – THANK YOU!
Nice to meet you, Brenda. I hope to write more soon. I’ve discovered some awesome WordPress themes that make development so easy that I’ll write about along with how to migrate WordPress to new host or from development site on a local computer to a new site, etc.
Angela
Cool. Glad it worked.
You’re welcome!
Hi Amanda,
I use Gravity Forms on just about every site I create, and I’ve never had this problem. If you think it’s the Silence is Golden plugin, then de-activate that and just make a copy of the index.php file you find in the wp-content folder and put that in the root.
I don’t think the Silence is Golden Guard plugin should cause this problem, but I do know someone else who had some weird issues and we disabled it as a result.
Check over all your settings again just to be sure you didn’t leave a forward slash at the end of your URLs in the General Settings. Email me via my contact form at http://moongoosedesigns.com if you still have trouble.
I would perhaps suspect more greatly that you need to clear your browser cache and perhaps you should reinstall Gravity Forms — perhaps you updated it at some point and one of the files didn’t update all the way. One person who wrote to me had issues she thought were related to this “moving” process but were really because she had just updated a plugin, and the update didn’t completely properly.
I would need to know your website URL.
Thanks so much!! This was the easiest tutorial to follow!
Hi Angela, Your way of explaining this process is fantastic, I have used it numerous times with absolute success. I have come across a problem with a site I am working on currently, within a plugin – Gravity Forms. All the internal hyperlinks, images, everything, works perfectly from the subdirectory install for every other plugin and image. Except within one area of the Gravity Forms plugin which is a link to a modal window from with the plugin dashboard. It returns the white screen (as as I have Silence is Golden running). If I don’t have Silence is Golden running then the sites index is listed. This modal window is meant to be a editing window, like a image edit window. I have been in touch with the Gravity Forms Developer, but they seem to think its the install? Have you come across any issue like this before? maybe have some tips?
Can I still tweak the site (the theme options, for example) and add pages and posts after I’ve gone through the process above?
Hi Lily,
Yes, it will work exactly the same as it does now. This simply allows the URLs to show from the main URL of the site, but WordPress is still in the sub-directory, so you will access WordPress via the same URL do now.
~Angela
Hey Angela, Thanks so much for the quick reply. I actually went ahead and did the process myself and saw that it is indeed editable. All went very smoothly, perhaps because i followed your directions to the letter. They are so well written. A million thanks!
BTW, I’m “Angelynn” and you can see my site now at http://angelynngrant.com.
I’m going to make a donation in gratitude.
Hi Angelynn. I love your site. Thanks for sharing. Glad it all worked out.
Thank you for the great post. I had a similar issue and helped me but now i see another problem. i cannot access my posts via the menu and get white/blank pages..any idea how to fix this?
Awesome! Thank you.
Angela, great post, really, thank you very much. You can tell how good a post it is by how many comments it receives WAY after it’s been posted! You wrote this a year ago people are making use of the info to this day! This guide really freed me up with a client; thanks again.
That’s awesome, Daniel. Thanks for the comment. I have been keeping the post updated since I wrote it, and also wrote an FAQ based on all the comments. It’s amazing how many hits it gets, and I know people get really stuck with this and have some urgency, so I try to be responsive. I might make a little video! I also am in the process of writing a post about how to migrate WordPress from one server to another using BackupBuddy.
WOW! This is awesome! It worked just like you said. Now, is it possible to move the ‘image’ directory by itself to the root to completely protect the location of the install? Thank you for all the help. 🙂
I did read a post somewhere (perhaps on Perishable Press) about being able to locate the wp-content and/or uploads folder to a different location, but it didn’t always work with specific plugins. So, I wouldn’t take the chances. It’s so easy for bots to find out “where” WP is installed, that it’s hard to totally obscure it and your site, if it gets hacked, is going to get hacked via a plugin or theme NOT WP core. The best you can do for security purposes is to be cautious about what plugins you install, keep everything updated all the time, and do regular backups of your database and wp-content folder using a plugin such as BackupBuddy (my affiliate link: https://askwpgirl.com/go/backupbuddy.php). Glad the process worked!
This is a great guide. Worked perfect.
Thanks.
Hi Anthony, So glad to hear that!
I’m just curious about reason #2 (extra security layer) as far as why you recommend placing WP in a subdirectory; wouldn’t it be as simple as copying the source URL of an image file on the site to realize where WordPress is installed?
Yes, true, but some bots are programmed to go to sitename.com/wp-admin or sitename.com/wp-includes. All the images are still viewable via the subdirectory, so it’s not a big “secret” where wp is installed, but can fool some bots looking for wp app files in the root.
Hi Wp Girl,
Currently my Wp develpoment site is in a seperate directory of the site root directory. The old site, which I will be removing, is in the root directory.
Your instructions are the most lucid I have come accross, but I found almost identical instructions at http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory, and there seems to be a conflict.
You say, “MOVE (do not copy) the index.php file,” and the other instructions say, “Copy (NOT MOVE!) the index.php.” In addition, the other instructions mention moving the .htaccess file to the root directory. Can you comment on this?
I could just experiment a little, bu I am fearful of digging a hle I can’t get otu of.
They suggest copying instead of moving, because when you move the index.php file from the subdirectory it leaves your subdirectory without an index file meaning that visitors can look at all the files in that directory. I have had best success with moving the file. If you copy it, people often edit the wrong file, try to access WordPress in a way they shouldn’t, etc. It’s just messy to leave a copy in the subdirectory.
After you MOVE the file, you’ll want put a blank “Silence is Golden” index.php file in the subdirectory so people can’t view your subdirectory contents. I describe how to do this in this post. You can find a “Silence is Golden” index.php file in the wp-content folder, the themes folder, and the plugins folder. It is in all of those folders to keep people from seeing the contents of those folders. If you open one of those index.php files, you’ll see some text that says “Silence is Golden.” It just is there as a non-displaying comment and results in a BLANK page being displayed when someone goes to the URL of that directory. Try it.
So, the wordpress.org instructions are not “wrong” per se, they are just not “correct” if you want to do things cleanly. I think they realize most people can’t handle too many steps in a process and don’t want to leave the subdirectory without any index file for security reasons. Make sense?
Hi WPGirl,
I would like to change my existing site substantially but need to work on these changes while the current site remains up for users. The switch from current site to new site would need to be pretty seamless in timing. Is it right to assume a second wordpress install to a subdirectory is a good way to work on a new site while the current site is up?
Would your instructions above allow me to ‘move’ the new site in the subdirectory to the current/old sites url? Sorry if my language is fuzzy but I’m obviously a bit green here, hopefully you understand what I’m asking 🙂
With that said, where would the best instructions be found for installing wordpress into a subdirectory? I ask you simply because I want to make sure I set this up properly for your instructions!
Thank you for your time,
BDA
Hi Bobby,
Yes!!! That is exactly what I do for current clients. Right now, I am redesigning a site for a client, so I used BackupBuddy plugin (https://askwpgirl.com/go/backupbuddy.php) and I did a full backup of the current site, created a new blank database, and then ftp’ed the backupbuddy backup plus their importbuddy.php script to the subdirectory where I’ll do the development on the new site, then ran the importbuddy.php script via the domainname/subdirectory/importbuddy.php url.
The beauty of backupbuddy is that it will update ALL the links and URLs, so they reference from the new location of WordPress in this new subdirectory.
So, then after you’ve “migrated” your current installation using backupbuddy to the new subdirectory, you can do all your modifications. When you’re finished, you can follow the steps in this post to have the pages from this subdirectory installation display from the root, so you all of the URLs will match the URLs as they currently are on the old site with the exception of images, which will all link via the subdirectory URL.
The beauty of this process is that all of your image links will not be effected when you do the “move.”
So, definitely use BackupBuddy to get the copy of the current site duplicated in the subdirectory correctly — unless you’re basically blowing away the current site and are starting fresh.
Feel free to email me via my contact form if this is at all confusing. Once you’ve done backupbuddy migration a few times, you can do it in your sleep or like I do — in a sort of half awake over-caffeinated zombie like state.
Cheers,
Angela
I am updating a site for someone who originally had another person working on it. He is not knowledgeable with website development. I have never used WordPress before this. Well, today I was playing with a URL change to just point to a different page. I went back afterwards to the General area and changed it back since it didn’t work. However, now I can’t access WordPress at all. I get the Internal Server Error. I don’t have access to the PHP area on my computer to change anything in the database. He doesn’t even have the WP install on his computer. I guess the previous person did all that. So, is there anyway for me to fix this or anyone who I can contact to do so?
You will need to get his web hosting control panel and FTP access to the site. Once you get the web hosting control panel access, you can login to phpMyAdmin which is an application you’ll see in the control panel. If it asks you for a password, you’ll need to have the FTP access to the site to find the database username and password in the wp-config.php file. Read the FAQ I have to this post for more information. Email me directly via my contact form if you get stuck. I charge $75/hour for support, and generally these issues are resolved in under an hour — usually 15-30 minutes.
Thank you for the nice tips . I have followed the steps in “How do I move WordPress from a subdirectory to the root directory?” and my pages still show url inside the subfolder. Do you know why? http://drangelebesner.com
Hi Walter. Looks like you didn’t follow all the tips exactly. Please read the post again and then perhaps read the FAQ and make sure you got it all step-by-step. Also check your permalink structure. Should not include the sub-directory name in that structure.
Angela I’m having problem with the permalinks they are still pointing to my subdirectory
Hi — Try to set your permalinks to the default and see if the pages work and let me know. Then, I can tell you what to check next.