Complete Guide on Moving WordPress Core Files into Root Directory

Transferring the WordPress core files into a root directory is one of the best way to secure your blog in case of being hacked. Today, we’ll take a look on how to move your WP core files into root directory like (from www.yourdomain.com/wp-admin, to www.yourdomain.com/blog-files/wp-admin or something else).

This will not affect your blog link www.yourdomain.com/blog-files, after all your blog link will be the same as www.yourdomain.com. If you are using permalinks that’s okay, we’ll also redirect the permalinks for your blog posts’ media files (from wp-content/uploads/ to root-directory/wp-content/uploads/). Alright.

A Complete Guide on Moving the WordPress Core files into Root Directory

Step by Step Guide on Moving WordPress Core Files to Root Directory

Let’s get in.

1. Login to your blog, goto Settings > General enter the WordPress Address URL (http://www.yourdomain.com/your-directory-here).

Moving WordPress Core files into a DIrectory

2. Click the button save changes.

Hint: don’t run your blog for now.

3. Secondly, login to your cpanel > File Manager.

4. If you are using multiple domains using the same hosting account then goto the root directory of the one blog for whom you’re trying to move the WordPress core files into another root directory.

5. Here, make a folder with the same directory which you’ve used in your WordPress Address URL before in the first step.

6. Finally, move all the wp- extension files and folders into the directory which you have just created in the step 5.

7. Edit up the index.php file from the main directory of your blog. Further see the following file for better understandings.

8. Save the file index.php and try running your blog now.

Related  How to Add 3D Hover Animations Effects on Images in WordPress

Congratulations we’ve done moving the WP core files into another root directory.

Setting up Permalinks

You should be happy that you are using WordPress, it makes a lot more easier to your blog, and don’t let you edit a couple of code.

1. If your blog is using permalinks, then goto Settings > Permalinks and update your permalinks once. This will automatically edit up your .htaccess.

Redirecting Media Files

You don’t need to upload all of your media files again because here is a very great plugin which will let you redirect all your files/folder at once. Just install and activate this plugin Velvet Blues Update URLsand follow these steps:

1. Goto Settings > Update URLs

2. Add this URL as old: http://www.yourdomain.com/wp-content

3. Add this URL as new: http://www.yourdomain.com/your-directory-here/wp-content

4. Save Settings.

Yep, you can enjoy blogging now with your new login page (yourdomain.com/your-directory-here/wp-admin).

Thanks for reading.

4 Comments

  1. Hi Muhammad, Assalamu alaikum. This is a great post with clear steps to do the move – thank you very much. I executed the move yesterday by moving my wordpress installation from root to a directory named ‘blog’. I have 2 questions:

    1. You mentioned that I should update permalinks. Does that mean that I prefix the directory ‘blog’ in all my permalinks. Previously I was using postname as the permalink. Now I have to make it custom with the word ‘blog’. Is there any way to avoid having the directory name in all my permalinks?

    2. I am using bluehost – there were many files there in the root directory that did not start with wp. I moved all of them including the folder cgi-bin. Is this right or wrong?

    I would appreciate your response

    1. Hi @SIRAJ SAMSUDEEN,
      Walaikum Assalam, at first I welcome you… Secondly the answers of your questions are as follows:

      1. The updating permalinks doesn’t mean that you got to change the prefix in the URL as “blog” however, it’ll automatically the changed with your blog prefix just after updating. As mentioned that (This will automatically updated in .htaccess)…

      2. You only should move the files and folders that starts from wp- not all that including cgi-bin…

      Hope, you would be able to move your WordPress installations into a root directory… BTW Thanks for the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *