Making Your WordPress Blog Look Like it’s in the Root Directory while Keeping it in it’s Own Directory

Having a WordPress site is great – there are so many advantages to it. There are also reasons you should have it in its own directory (see below). But, as a matter of professionalism, you want your urls to be clean when the public visits your site. In other words, I wouldn’t want people to have to type http://www.websitedesignerinseattle.com/wp/ to get to my site, right? Even though that is actually where it lives. I want people to type http://www.websitedesignerinseattle.com/. Makes sense – it’s much more professional.

A Few Words About File Management

First I should mention that I have a thing about file management. There are few things that annoy me more than when I’m hired to redesign a website and I find that the last web designer had a million files just sitting in the root directory with no thought to file management. It’s disorganized and can be overwhelming to make heads or tails of it all. It’s like walking into someone’s kitchen and all of their plates, cups, pots, pans, utensils are all just sitting on the counter piled into one jumbled mess. Come on people, separate your things and put them away. Sure it takes some thought at the beginning, but in the end, it will make your life much easier if you know where everything is.

WordPress and File Management

When you are first setting up your WordPress blog you’ll have a choice about where you install it. If you’re doing an install through a hosting service (GoDaddy, Network Solutions, etc.) you’ll be asked which directory in which to install it. I always use something really clever like “wordpress” or “wp” or “new” or “blog”. Super-creative, I know. If you’re doing a manual install, same thing applies, just create a folder and put all of your wordpress files there and proceed with installation.

But I want it to look like it’s in my root directory

I know, I know… it will. But first let me say this about your root directory. While you’re building your website, you shouldn’t have it visible to the public anyway. You don’t want to have your work in progress out there for people to look at. Make a nice looking “coming soon” page with all of your contact info, in a style that matches your brand with your logo for index.html page of your root directory. Then when you’re done  building your new snazzy WordPress blog site you can make the switch.

Making the Switch

You only need to alter a couple of files to make it look like your WordPress site is your root. The first thing you need is FTP access. If you did a manual install, you obviously have this. If you installed your WordPress site through your web host, you have two choices: 1) you can use their FTP client (by the way, FTP stands for File Transfer Protocol. You had to define an FTP user name and password – different from your account log in – when you set up your hosting); or 2) you can use a third party FTP client (Dreamweaver, WinSCP, FileZilla, etc.) to upload/download your files. Either way, these are your instructions:

1) Log in to the Dashboard of your WordPress site

2) Go to Settings / General and change the Site Address (URL) to your root, like this:

This will automatically change the .htaccess file on the server.

3) Open up your FTP Client or navigate to files using your web host’s file management tool. Copy (IMPORTANT: COPY, DON’T MOVE) the files .htaccess and index.php into your root directory.

4) Open up index.php and make sure the line at the bottom that reads: require(‘wp/wp-blog-header.php’); is pointing to the directory where your blog actually lives (in this case, the directory is ‘wp’).

Upload the files to the root directory. And that’s it.

 

Facebook Twitter Email

44 Responses

  1. dennis January 31, 2012 at 10:17 pm #

    Lovely site

  2. Tony May 26, 2012 at 11:27 am #

    Thank you very much for these instructions! I was getting very frustrated with the redundant mysite.com/wordpress. Now it’s just mysite.com :)

    • admin May 26, 2012 at 1:43 pm #

      You’re welcome. Glad I could help!

  3. angie July 13, 2012 at 12:28 pm #

    Thank you for the well-written explanation. One question though, what exactly is inside the htaccess file that needs to be copied over?

    • admin July 13, 2012 at 5:02 pm #

      The htaccess file written by wordpress when you change the General Settings as outlined above. It has the rewrite info. It’s what determines how the files are shown in the location bar. Here’s an image of the .htaccess of this website:

  4. LynnC August 23, 2012 at 10:09 am #

    Wow that actually worked! :) Thanks for the info!

  5. Steve August 28, 2012 at 10:36 pm #

    Thanks, I used your info and it worked perfectly.

  6. Elsie October 31, 2012 at 11:13 pm #

    Pulling my hair out! LOL can you tell me, using the hosting co. Network Solutions (hate it) for a client.
    He has 3 domains in the same hosting account. So have to install wp in a separate folder as you have done here. Is the root directory the htdocs folder? and if so, and I want to change it on all three blogs so each only has the address of the actual domain name, then how would I do that? I have tried to get help from support but no luck. grrrr Would I do what you have suggested and upload all three .htaccess and index.php files to the htdocs folder? seems each would just overwrite the previous one. Thank you for any help as I just am not used to that sort of hosting account. I am used to bluehost and hostgater cpanels. So easy. hehe Hugs Elsie

    • admin November 1, 2012 at 9:46 am #

      So I’m sure you’ve discovered that the help section at Network Solutions is completely useless. Sounds like there are three distinct domains running of the same hosting account, right? I think the best way to tackle this would be to create subdomains. Then you can point the domains to the right place and should be able to mask those subdomains. They will just show up as folders when you use a 3rd party FTP client. I’m no expert for Network Solutions, but I had a similar situation with a client recently and that was what I did.

  7. Grace November 14, 2012 at 10:06 am #

    Dear Anamaria – Thank you for the lovely writeup. But of course nothing is as easy as it seems. I’m porting a little website from HTML to wordpress for my friend, and followed your instructions after a successful Network Solutions install into my /htdocs/wordpress/ directory. The redirect works fine for the home page, but I get a lovely fatal error for the remaining pages on the site:

    Fatal error: require() [function.require]: Failed opening required ‘./wordpress/wp-blog-header.php’ (include_path=’.:/usr/services/vux/lib/php’) in /data/18/2/145/79/2145568/user/xxxxxx/htdocs/wordpress/index.php on line 17

    I also read: http://wordpress.org/support/topic/warning-mainwp-blog-headerphp-error and tried the suggestion to: Remove the “./” as suggested thusly:
    require(‘./wp-blog-header.php’);
    Becomes
    require(‘wp-blog-header.php’);

    But I get the same fatal errors.

    WordPress gives similar instructions as you did, specifically the “Using a pre-existing subdirectory install” section of: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    Other thoughts? Thanks in advance!
    Grace also in Seattle

    • admin November 14, 2012 at 10:16 am #

      If this doesn’t work, I’m happy to help you offline – you can email me privately with ftp info and wordpress info at abaralt@gmail.com.

      but just to double-check, your index.php document looks like this, right?
      require(‘wordpress/wp-blog-header.php’);

      • Grace November 14, 2012 at 10:36 am #

        Dear A – With much hair-pulling, I discovered a solution that appears to work: Both you and WordPress Codex say “Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address)”. But I think it is misleading. I COPIED the index.php file and MOVED the .htaccess file. Once I removed the duplicate .htaccess file from my /htdocs/wordpress subdirectory, then I stopped getting the fatal error and my site now loads.

        Thanks for being a voice of calm when someone needs to get a site up and running RIGHT NOW, and of course all the instructions online say “contact your site administrator”, which is hard, when *I’m* the site admin for my friend!

        • admin November 14, 2012 at 10:39 am #

          Good to know! I’m glad it’s working… there is nothing more stressful than technical problems :)

          • Karen Oakley November 28, 2012 at 12:39 pm #

            I am noticing that I have double the address code in the URL bar. The index page works fine but the other pages show something like this:

            http://debbiunger.com/#!/http://debbiunger.com/contact/

            I followed all the directions up above including the trial/error that Grace from Seattle went through. Is there something I’m missing? This website is also hosted with Network Solutions.

          • admin November 28, 2012 at 4:38 pm #

            Hard to say without getting in there to take a look. I haven’t seen that happen before. If you want to send me your log in info and ftp info I’m happy to take a look for you.

  8. Guy Lachapelle January 3, 2013 at 12:35 pm #

    Thank you so much, this worked perfectly. I tried this earlier today and had failed miserably – I thought I was going to have to reinstall my wordpress and restart my blog.

  9. Carrie January 13, 2013 at 7:10 am #

    Thank you so much for this. I was on the phone for an hour with Network Solutions trying to figure this out. Their suggestion to me was to switch my site to wordpress.com or to “just move the files over to the directory you would like”

  10. Tom February 6, 2013 at 4:16 pm #

    Brava, Ms Baralt. Thanks for the elegant approach. I want to operate behind-the-scenes during the initial ‘Flailing About’ phase of my first WP site, and your suggestions should enable me to do that (and save me having to install a XAMP or WAMP server emulation on my local computer).

    The following issue was touched upon in the comments, but not fully resolved. I realize it may be beyond the scope/intent of your posting here, but allow me to ask anyway in hopes that a simple answer might emerge. If not, no worries.

    GIVEN: A shared Unix NetSol account hosting three (3) distinct website URLs. The root directory is …netsolhost.com/htdocs/ It contains the .htaccess file and three subdirectories – one for each hosted website: Apples, Bananas, Coconuts

    I would like to create three (3) WP sites – one for each hosted URL. I assume I am to create a /WP subdirectory in the Apples directory, another in Bananas, and a third in Coconuts. With three instances of WP, I’m pretty sure there will still be only a *single* instance of .htaccess, and it will remain in the root directory for the entire account. Yes?

    I’m confused about what to expect when updating the WP Settings (as you suggest) for Apples, followed by Bananas, followed by Coconuts. Will the Bananas update overwrite the Apples update within .htaccess, such that the .htaccess file only works with the *most recent* WP site Settings update? OR will the contents of that single .htaccess file accommodate and include *all three* WP sites simultaneously.

    I know this is pretty esoteric, but any advice will be most appreciated.
    Duh

    PS I needed to view your video tutorial in 720p so I followed the link to YouTube. Ended up watching your underwater videos. Fascinating(!) and your Cole had me laughing, too =)

    • admin February 6, 2013 at 5:03 pm #

      Well, like any good web designer, I enjoy a puzzle. Especially when presented in the form of a fruit salad. But I’m unclear as to how you’re structuring this site. This is what I’m reading. You have a main directory located under htdocs: fruitsalad.com. You have 3 subdomains: bananas.fruitsalad.com, apples.fruitsalad.com and coconuts.fruitsalad.com. You may be masking them I suppose to appear as bananas.com, apples.com and coconuts.com. Each of these has their own WP installation in their own subdirectory folder: htdocs/apples/wordpress/, htdocs/bananas/wordpress/ and so on, correct?

      These are three completely different databases. The domains will be pointing to their respective directory. The .htaccess file that you need to worry about will be the one in each of those directories: htdocs/apples/ and htdocs/bananas/ and htdocs/coconuts/. You’ll need to pretend that they really are 3 completely different entities. Am I making sense? Am I understanding what you’re trying to do.

    • admin February 6, 2013 at 5:04 pm #

      PS Cole keeps us laughing too! And although I am a SCUBA instructor, those aren’t my videos – they belong to a client of mine.

  11. Tom February 10, 2013 at 2:59 pm #

    Ms Baralt == I’m not sure whether the following is an exact alternate way of getting there, but it does work. Network Solutions customers can use the NetSol simplified WordPress setup, and then redirect the domain name to the new WP site later, when it’s ready to go public:

    SETUP THE WORDPRESS SITE
    Network Solutions > Manage Account
    > select the “My Products & Services” tab
    > select “My Hosting Packages” link (see Web Hosting Dashboard page)
    > see “WordPress Add a Blog” > select the “Add” button
    > Work through Steps 1 to 5
    In Step 1: Do *NOT* check the box, “Check this box to make this WordPress your web site homepage.”

    WHEN YOUR WORDPRESS SITE IS READY, REDIRECT THE DOMAIN TO SEE THE WP SITE AS THE HOMEPAGE
    Network Solutions > Manage Account
    > select “My Products & Services” tab
    > select “My Hosting Packages”
    > select the LIGHT BLUE BUTTON “Web Hosting Toolbox” at upper-right
    > see the “Web Hosting for Premium (Hosting-Unix)” page
    > see “Site Enhancements” sub-heading > select the “Open Source Applications” link
    > select the “Manage” link
    > select the “Make this wordpress my homepage” link

  12. does eating for energy work February 26, 2013 at 7:41 am #

    Whats up this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to
    manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

    • admin February 26, 2013 at 8:53 am #

      Off topic is ok. That’s the great thing about WordPress. If you know nothing about coding, you can still publish a pretty robust website using their WYSIWYG. Your hands are tied based on the theme you choose, but you can still get it online. If you’re an expert coder, you can use a theme as a basic skeleton of architecture and rewrite as much of the php files and css stylesheets as you want and make your own custom child theme – that’s what I do.

  13. Larry Irons March 7, 2013 at 8:10 am #

    When I follow your instructions my home page does not display correctly,yet the other three pages in the website do. Before changing the .htaccess and index.php they all display properly. The references to the domain in the database are set correctly. Is there something else I should check?

    Also, just a note that the WordPress instructions for this say to move the config.php file to the root. It doesn’t affect the behavior in the website I’m working on but just wonder if you have thoughts on why they say to move it. See http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory and the section titled “Using a pre-existing subdirectory install “

    • admin March 13, 2013 at 8:55 am #

      Hey – sorry for the delay. This one slipped through the cracks. The wp-config file instructions matter if you’re running your blog on a Windows (IIS) server, instead of Linux / Unix. I hope you got it working ok. I can’t really help any further without seeing the files.

  14. Sarah March 13, 2013 at 5:54 am #

    Hi there, first time using network solutions and I HATE IT! This seems like such an easy fix but I can’t move index.php to the root directory, it only allows files to be uploaded to the htdocs directory so no matter what I try my website always ends in /wordpress. Please help!

  15. Sarah March 13, 2013 at 6:38 am #

    So I followed your instructions and moved things to the htdocs folder since that’s the root folder things can go in and voila, it works… except… the home page. So http://energycoachcarla.com/sample-page will load fine without the /wordpress but I have no index page because now it’s just page not found

    • admin March 13, 2013 at 7:00 am #

      Hi Sarah – I’m not sure what’s going on. I have a few minutes this morning. I’m happy to take a look if you want to email me your ftp log in and your wordpress log in.

  16. Dan March 25, 2013 at 1:03 pm #

    Very helpful post; thank you!

  17. Joshua May 10, 2013 at 5:06 am #

    Thank you. Just wondering….. why wouldn’t I have an .htaccess file?

    • admin May 10, 2013 at 5:31 am #

      It’s more likely that you have one, but you can’t see it. Make sure your FTP client is set up to see hidden files.

      Even so, I had this situation recently with a client that was hosted at DreamHost (my least favorite hosting company): despite my settings being right, I couldn’t see the .htaccess file. They assured me it was there, but for some reason I couldn’t get to it. I found a workaround. You can access the .htaccess file from Yoast’s SEO for WordPress plugin (awesome plugin – everyone should use it). Here:

      yoast - edit files

      • Lisa June 13, 2013 at 10:10 am #

        Found this helpful video when trying to point my root domain to my wordpress subdirectory files (to change over my old site to my new site). I use Dreamweaver CS5 (on Lunar Pages hosting) but even with “view hidden files” … cannot see the htaccess files. I’ve added the Yoast SEO plugin in WordPress … but how do I copy the index and htaccess files to the root from within the plugin?

        • Lisa June 13, 2013 at 10:16 am #

          Actually found where to do it under “edit files” … but the SEO within WordPress even says there is no htaccess file….

  18. Vidin May 16, 2013 at 12:51 am #

    Can we have two wordpress on single domain name with one pointing to root and other to a test/beta folder. Both of them should be replica of each other. The beta wordpress is where i will test and edit first and then implement on live site?

    • admin June 9, 2013 at 7:55 pm #

      Sorry for the (very) delayed response. I’m sure you already have the answer to this: yes. Whichever one is the live site will have the matching .htdocs & index.php info in the root files.

  19. dinami May 27, 2013 at 7:51 am #

    I’ve done everything it said but still no luck. I’m using the ever so unpopular Network solutions. I noticed everyone has domain.com/wordpress. But on mine it says domain.com/wordpress1?? Is there a difference? I’m getting really frustrated here. Please help.

    After you do this is there a wait period? or does it change the url right away?

    And you mentioned before about permalinks? What should we write in the custom structure?

    • admin June 9, 2013 at 7:53 pm #

      I’m sorry for the delayed response! I trust you’ve found answers to your questions already elsewhere, but just in case…

      RE: domain.com/wordpress1 vs. domain.com/wordpress That shouldn’t make a difference. It could be named: domain.com/howdydoody and it wouldn’t make a difference.

      No, you shouldn’t have to wait. This is immediate.

      Permalinks: doesn’t matter what the custom struction is as long as it isn’t this one: http://websitedesignerinseattle.com/?p=123 (that’s the default). Aside from that, it’s a personal choice. I always choose the third one: http://websitedesignerinseattle.com/2013/06/sample-post/

  20. Paul June 8, 2013 at 1:18 pm #

    Hi
    Thanks for the Video
    I am about to create a brand new website using WordPress. Are there any down sides to keeping in a subdirectory and redirecting to root ? I was thinking of search engines. Also can you still access the site via the subdirectory URL?

    • admin June 9, 2013 at 7:49 pm #

      Nope – there are no down sides to keeping it in a subdirectory. Remember that wordpress is calling up content from a database. It’s not like these are html files living in a subdirectory and then redirected once they’re called up. After you go through this process, for all intents and purposes (as far as search engines are concerned), your “files” are in the root.

  21. Emily June 12, 2013 at 1:38 pm #

    Hi,
    Thanks for your information. I have some question about Root Directory and hope you could help. After I change Site Address (URL) to the root. There are 2 functions not working anymore. 1) Show Toolbar when viewing site 2) Preview Draft , I got this error “You do not have permission to preview drafts”. If I put the directory back to Site Address (URL), it is working. Anyway to resolve this problem?
    Thanks,
    E

    • admin June 12, 2013 at 2:12 pm #

      Hmmm… the short answer is: I don’t know. That said, I have had the WP admin act a little wonky after doing this until I refreshed the browser window. You aren’t just changing the site address though, right? You’re editing the htaccess and index.php files, right? Just changing the site address without the other steps can cause some problems I’ve noticed.

      • Emily June 13, 2013 at 6:46 am #

        Thanks for your reply. I have updated the Permalink structure after I uploaded index.php and .htaccess files. It is working now! Thanks.

Trackbacks/Pingbacks

  1. Web Hosting Woes | Carrie Nagy - January 15, 2013

    [...] found a solution from Barlat Design, Making Your WordPress Blog Look Like it’s in the Root Directory while Keeping it in it’s Own Di…. Thank you Barlat Design you saved the day. Did you like this? Share [...]

Leave a Reply