WordPress Management: Cleaning Up Your Root Folder

Most of the time I’m a very organized person. I say most of the time because being that I blog from home and having two little boys, one and three, being organized at home can sometimes be a challenge.

Ketchup might splatter on my keyboard and at times there might be a Thomas The Tank Engine sitting on my desk, but if there’s one thing I know I can keep organized, it’s my WordPress hosting files. When I log into my hosting account, everything is tucked away nicely and files are easy to find.

When you install WordPress, by default it places all its core files in the same directory of your WordPress installation. So for example, if you placed your blog in your root directory (i.e. www.myblog.com), then your web hosting root folder will include all the WordPress system files.

Below and on the left is an example what a typical WordPress directory looks like. Pretty cluttered up with a lot of stuff you don’t need to know about, huh? On the right is an example of what you can do by moving all those core files and folders out of your root directory and into a subdirectory (in the example below, the subdirectory is /root-blog.

clutter

So how do you do that?

Well you’re in luck, because have I got a video for you.

As I mentioned in the video, it might be wise to create yourself a maintenance page where you can send your visitors to while you’re moving your files around. The move shouldn’t take long, but just in case you missed how to redirect your visitors to a maintenance page while your site is down, here’s how I showed you how to do it in my post, How To Install WordPress Manually.

How To Create A Simple Maintenance Page

You could always download a WordPress maintenance mode plugin, but in this case it probably won’t work. During the move process you’ll be moving your /wp-content folder, which contains all your plugins. This will cause your site to not load; therefore, it’s best to have your own maintenance page independent of WordPress.

So, here’s how to create a custom maintenance page without a plugin.

Step 1

Create a simple html file and place it in your blog’s root directory. Name it something like, maintenance.html. Inside the maintenance.html file you can put anything you want. “Hi. I’m out to lunch for a few moments while the construction crew is busy at work . . .”

But why stop there? Your site is better than that. Customize the page with your site’s colors and images. Maybe add a video or your latest blog post. CSSgirl wrote some tips and shows some examples on the topic of creating a memorable maintenance page.

Step 2

Ok so now you have your maintenance.html page set up; the next step is to redirect everyone to it while you’re doing your upgrade.

Navigate to your blog’s root directory in your web hosting control panel and open your .htaccess file.

htaccess-edit

Once opened, you’re going to add this code at the top:

# Use this code to redirect visitors to maintenance.html file while upgrading
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^618\.124\.259\.25
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule $ http://your-site.com/maintenance.html [R=302,L]

The yellow parts above are the areas you need to change. Visit What is my IP address? to find your IP address and put those numbers in under the first yellow highlight. Next add the url path to your own maintenance page in the second yellow part.

And that should do it. Your site should now show a maintenance page to everyone except you (your IP address was whitelisted). To see what everyone else sees, add a # sign in front of the IP line:

# RewriteCond %{REMOTE_ADDR} !^618\.124\.259\.25

The # comments lines out.

When you’re finished, leave the code in your .htaccess file for next time. To disable the code, just add a # in front of each line:

# Use this code to redirect visitors to maintenance.html file while upgrading
# Options +FollowSymlinks
# RewriteEngine on
# RewriteCond %{REMOTE_ADDR} !^618\.124\.259\.25
# RewriteCond %{REQUEST_URI} !/maintenance.html$
# RewriteRule $ http://your-site.com/maintenance.html [R=302,L]

Remember, if you need help with upgrades or moving your files around like in this tutorial, visit the blog services page and use the contact form there to get in touch with me. This is a service I can provide.

Questions?

Fire away.

Related posts:
  1. How To Create A Maintenance Page Redirect When WordPress Is Down
  2. How To Upgrade WordPress Manually Video
  3. How To Install Google Analytics On A WordPress Blog Without Using A Plugin
  4. Hammering Down 2 More Ways To Speed Up Your WordPress Blog
  5. WordPress 2.8.2 Has Been Released & Provides Security Fixes

, ,

Want to say thank you? View my Wish List...

16 Responses to “WordPress Management: Cleaning Up Your Root Folder”

  1. Jim Gaudet Says:

    What would you suggest to secure this directory?

    I was thinking of putting an .htaccess file in there, but what settings should I use?

    Thank John!
    Jim Gaudet´s last blog ..Social Media Sanity | Web Community Engagement My ComLuv Profile

  2. John Hoff Says:

    Hi Jim.

    No worries about needing a .htaccess file in that newly created directory. Whatever directives you have in your root .htaccess file will trickle down to all subfolders.

    I see in the image in my article I show a .htaccess file in that new directory, but it’s an empty file. My permalink structure and everything else all exist in the root .htaccess file.

    The only time this might be an issue is if you’re referencing a specific file by location in your .htaccess file. If that’s the case, you might need to update the location of that file.

  3. Barbara Ling, Virtual Coachb Says:

    Excellent suggestion! However, I do have one question – if you’re using DHCP, wouldn’t your IP change every time you accessed your service provider?
    Barbara Ling, Virtual Coachb´s last blog ..6 Brilliant Squeeze Page Resources You’ll Want To Explore Part 1 My ComLuv Profile

  4. John Hoff Says:

    Hi Barbara. Moving your core WordPress files into a separate directory shouldn’t have anything to do with IP addresses. All you’re doing is moving a few files into another directory and then telling WordPress where they are.

  5. Barbara Ling, Virtual Coachb Says:

    That I know…but I was referring to:

    RewriteCond %{REMOTE_ADDR} !^618\.124\.259\.25

    If your IP changes, would that require updating?

    Thanks!
    Barbara Ling, Virtual Coachb´s last blog ..6 Brilliant Squeeze Page Resources You’ll Want To Explore Part 1 My ComLuv Profile

  6. John Hoff Says:

    Gotcha ;)

    Well ideally you don’t need to keep funneling visitors to your maintenance page for more that 5 minutes or less, so whitelisting your current IP shouldn’t matter.

    Also, how often does your IP change? I don’t experience a change too often. But here’s an alternative: You could also edit that to only include the first two numbers of your IP.

    So for example, if your IP address is currently 618.124.259.25, the line would look like this:

    RewriteCond %{REMOTE_ADDR} !^618\.124

    Typically, even on a dynamic IP address your first two numbers won’t change or if they do, very rarely.

    This alternative would allow a few more people access to your site and skip through the maintenance page, but in comparison to how many people are online, the number is few.

  7. Barbara Ling, Virtual Coachb Says:

    Thanks for the clarification!!
    Barbara Ling, Virtual Coachb´s last blog ..6 Brilliant Squeeze Page Resources You’ll Want To Explore Part 1 My ComLuv Profile

  8. Tumblemoose Says:

    John, John, John:

    Hey look! I finally made it here! My ISP couldn’t figure out why I wasn’t able to get here but when I arrived through Stumble, I was able to subscribe and now things are marvy!

    I’m afraid to look at my files over at ‘gator. They’re a great big meanie and I suspect have been multiplying like bunnies.

    I’m bookmarking this in the hopes it will give me the courage to enter the wicked castle of WP and slay the demon dragon.

    Cheers!

    George
    Tumblemoose´s last blog ..The House blogging method My ComLuv Profile

  9. John Hoff Says:

    LOL Tumblemoose. Written like a true writer!

    You do make a good point, though. If we blog for a period of time and don’t really pay much attention to keeping our hosting clean and organized, it can become cluttered with a lot of random stuff.

    Glad to see you are able to visit now and thanks for the comment.

  10. John Hoff Says:

    @Jim and Barbara – Thanks for the stumble. I appreciate that.

  11. Jannie Funster Says:

    Hey John, nice to hear your voice on the video there. I guess you got to record it when the young-uns were out at the park or such?

    I should probably do this for my blog, as if I ever deleted any it would no doubt wreak havoc.

    And thanks for your YouTube tip yesterday, worked like a charm!
    Jannie Funster´s last blog ..Lazy River Sunday (Formerly Titled “Frisky Jim at the Water Park”) My ComLuv Profile

  12. John Hoff Says:

    Hi Jannie. Ah, the kids were asleep when I recorded that one! And glad to hear the YouTube tip worked. Thanks for stopping by.

  13. Davina Says:

    John, you are so good at presenting this information. I can’t remember the last time I was even in my Cpanel. The thought scares the hell out of me.
    Davina´s last blog ..There’s Life Coaching & Then There’s Just Life My ComLuv Profile

  14. John Hoff Says:

    lol Davina. I suppose if you never visit your cPanel then this tutorial probably doesn’t really apply much.

  15. Barbara Swafford Says:

    Hi John,

    I haven’t had time to view the tutorial yet, but cleaning up my files in on my “to do” list. I like that I can come here, hear your fine voice, and learn how to do things the right way.

    BTW: Is that also a service you provide? (cleaning up a person’s root folder)
    Barbara Swafford´s last blog ..When The Conversation Stops My ComLuv Profile

  16. John Hoff Says:

    Hi Barbara. We all have those to-do lists, don’t we. Moving core files out of the root folder is definitely a service I can provide.


Leave a Reply

CommentLuv Enabled
PHVsPjxsaT48c3Ryb25nPndvb19hZHNfcm90YXRlPC9zdHJvbmc+IC0gdHJ1ZTwvbGk+PGxpPjxzdHJvbmc+d29vX2FkXzMwMF9hZHNlbnNlPC9zdHJvbmc+IC0gPC9saT48bGk+PHN0cm9uZz53b29fYWRfMzAwX2ltYWdlPC9zdHJvbmc+IC0gaHR0cDovL3dwYmxvZ2hvc3QuY29tL2Jsb2cvd3AtZmlsZXMtZ3JlZW5ibG9nL3dwLWNvbnRlbnQvdGhlbWVzL2ZyZXNobmV3cy9pbWFnZXMvZWluc3RlaW5zaG93LWFib3V0LXdwYmxvZ2hvc3QzMDB4MjUwLmpwZzwvbGk+PGxpPjxzdHJvbmc+d29vX2FkXzM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