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

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

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 https://www.websitedesignerinseattle.com/wp/ to get to my site, right? Even though that is actually where it lives. I want people to type https://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:

See how the WordPress Address and the Site Address are different? 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 ‘wp2’).

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

 

By | 2018-11-19T18:50:59+00:00 January 23rd, 2012|Web Design Articles|25 Comments

About the Author:

25 Comments

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

    Lovely site

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

    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 - Reply

      You’re welcome. Glad I could help!

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

    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 - Reply

      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 - Reply

    Wow that actually worked! 🙂 Thanks for the info!

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

    Thanks, I used your info and it worked perfectly.

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

    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 - Reply

      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 - Reply

    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 - Reply

      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 - Reply

        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 - Reply

          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 - Reply

    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 - Reply

    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. Web Hosting Woes | Carrie Nagy January 15, 2013 at 4:13 pm - Reply

    […] 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 […]

  11. Tom February 6, 2013 at 4:16 pm - Reply

    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 - Reply

      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 - Reply

      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.

  12. Tom February 7, 2013 at 2:02 pm - Reply

    Ms Baralt == Thanks for your helpful (and quick!) reply. Apologies for dragging a Creative Director so far into TechSupport territory. My “fruit salad” as you describe it (haha) probably is a bit confusing, and it all qualifies a “monkey food” so that probably reflects badly on me… =). To clarify, Apples, Bananas and Coconuts (ABC) are three *entirely* separate websites – nothing to do with one another. The three just happen to be hosted in a single hosting account.

    I intend to create a WP blog for each site. Today I began the site for Apples in htdocs/apples/wp1.
    I used the Network Solutions standard install and chose *not* to make the WP blog the home page. I will build the WP site “behind the scenes” and won’t be ready to implement your instructions for re-directing the domain name for at least a week. So I’m not in a position (yet) to test what I’m about to suggest, but I thought perhaps you might focus your expertise on the matter and clarify it for your readers:

    I called Network Solutions prior to setting up my first WP subdirectory and asked a few questions. The TechSupport rep suggested an additional step that *might* assist people who’ve posted their difficulties here in your blog: He advised using the Network Solutions Manage Account “Dashboard” to re-direct the domain name manually, from its current focus to the new WP subdirectory. It’s a simple process:
    1. Enter the NetSol Account Manager
    2. Select the “My Hosting Packages” link
    3. Select the “Assign/Edit Your Domain” link
    4. Locate the appropriate domain in the list and select its blue “Edit” link
    5. Next page displays a drop-down text box with every possible directory
    6. Choose the intended target directory, then select the blue “Select” button at right

    This may take a while to propogate (up to 48 hours…?). Also, in my case, the new WP directory located at htdocs/Apples/wp1 does *not* appear in the list (hmmm?) even though that WP site appears to be fully functional. Looks like I’ll be calling NetSol again tomorrow (ugh). Thanks, Anamaria.

  13. Nicholas September 4, 2017 at 3:36 pm - Reply

    Nice weblog here! Additionally your site so much up very
    fast! What host are you the use of? Can I get your associate
    hyperlink for your host? I want my site loaded
    up as fast as yours lol

  14. Richard Rewey August 4, 2018 at 7:41 pm - Reply

    Thank you so much! I know I’ve done this before, but it’s been a while. Your video was \clear and concise.

Leave A Comment