• Home
  • My Products
  • Reviews
  • WordPress
  • Learning
  • Things to Avoid

Marketing With Vladimir

Welcome to my Internet marketing laboratory

You are here: Home / WordPress / How to Move a Blog From Root to a Directory

How to Move a Blog From Root to a Directory

April 7, 2015 Leave a Comment

How to Move a Blog From Root to a Directory

During my early weeks’ training within P2S coaching program, I was taught to make a fresh WordPress installation in /blog directory, rather than the website’s root directory, and have it served from the mentioned directory.

The reason for this is to be able to install more than one WP instances in the same domain, each one in its own directory, for the different products we are going to create.

Well, I already had this rather young IM niche blog and I wanted to reuse it. It already had good posts with good rankings on Google’s first page, most of my actual traffic being from organic search. Even if the traffic was weak, I didn’t want to lose all this starting advantage, so I decided to move the old blog. But it was necessary to devise a strategy for this move.

The following tutorial applies for a Linux hosting account with Apache web server.

The Desired Result

Let’s consider my domain as an example. So, my old blog was accessible at this address:

  • www.marketingwithvladimir.com

After the move the address has changed to this:

  • marketingwithvladimir.com/blog

I wanted also to get rid of the preceding www because I think it makes the URLs too long. In order to make the move AND not lose all the backlinks and rankings, it was necessary to add some 301 redirects. Keep reading to find out how.

The moving part could be done in 2 ways:

  1. configure WP in the General Settings admin page for the new path and move the actual WP files to the new location, or
  2. make a new install with the Softaculous utility from your CPanel in the new directory, export the content from the old, then import it into the new WP instance.

I opted for the second way because I wanted to start over from scratch. So, here are the steps:

The Steps

  1. Go to the old blog’s Tools->Export admin screen and export the entire content to your local computer. Make sure to remember the location where you save it.
  2. Go to your hosting CPanel and locate and click on the WordPress installation utility.
  3. Start a new installation by clicking Install in the upper menu.
  4. Make sure to change In Directory box content to the desired destination directory, in my case blog.
  5. Change all other fields to suit your desire. It’s advisable to change the admin username into something else, for example, your name.
  6. Click Install button.
  7. After the installation gets finished, point your browser to the back-end of the newly installed blog, domain_name/blog/wp-admin, in my case marketingwithvladimir.com/wp-admin. You’ll have to log in using the credentials you entered during WP installation.
  8. Go to Tools->Import page and select to import from WordPress. You’ll have to install the WordPress importer plugin. While importing, locate the file created during the export phase.
  9. Got to Settings->Permalinks page and change to Post name. It is advisable to do this because it makes your blog more friendly for search engines. You can remove the final slash character if you desire, depending on how do you want the posts and pages URLs to look, it’s up to your taste.

Now you can uninstall or delete the old blog.

Add 301 Redirects in .htaccess

Now, if you want to redirect all www.domain_name.com/post_name to domain_name.com/blog/post_name you have to add a few directives in the root .htaccess file.

You may find my root .htaccess here, the relevant part only:

# prevent directory listings
Options -Indexes
RewriteEngine On
# redirect www to non-www and subdir
RewriteCond %{HTTP_HOST} ^www\.marketingwithvladimir\.com$ [NC]
RewriteRule ^(.*) https://marketingwithvladimir.com/$1 [L,R=301]
# redirect non-www root to subdir
RewriteCond %{HTTP_HOST} ^marketingwithvladimir\.com$ [NC]
RewriteRule ^/?$ /blog [L,R=301]

Line 2 is to prevent directory listing.

Lines 5-6 redirect any www-based URLs to non-www ones with the path preceded by the blog’s directory, so that any old URL is globally redirected to its corresponding new URL.

Lines 8-9 redirect any non-www root URL to the same non-www with the blog’s directory appended, so that if you enter only the domain name in the browser, an automatic redirection to the blog’s home page is done.

You can edit the .htaccess file using an FTP utility application.

Update – April 9th, 2015

After moving the blog to the /blog directory I made the necessary changes in Google Webmaster Tools and Google Analytics. After a day or two, the new addresses finished indexing.

Then I checked Google SERP to see the positions of my old posts. After only one more day the new post addresses have replaced the old ones keeping their positions on page one. That was quite a pleasant surprise!

It seems that Google figured out about the move. I suppose that the 301 redirect helped as well.


That being said, I wish you good blogging.

Read Also:

  • Blog in Directory
    How to Move a Blog From Root to a Directory Part 2: robots.txt and .htaccess

    After I moved my WP blog from root to /blog/ directory I wrote this post where I explained how I did…

  • Blog in Directory
    How to Move a Blog From Root to a Directory Part 2: robots.txt and .htaccess

    After I moved my WP blog from root to /blog/ directory I wrote this post where I explained how I did…

  • Blog in Directory
    How to Move a Blog From Root to a Directory Part 2: robots.txt and .htaccess

    After I moved my WP blog from root to /blog/ directory I wrote this post where I explained how I did…

About Vladimir

I have a solid background in computer networking and programming. I recently started to develop applications related to internet marketing.

« Top 20 Free WordPress Plugins for 2015
How to Add PHP Code to WordPress Without Touching the Theme »

Leave a Reply Cancel reply

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


Recent Reviews

  • 24 Hour Profits – Review and Case Study

    24 Hour Profits – Review and Case Study

  • New Ultimate Stock Photos Package with MRR – Review

    New Ultimate Stock Photos Package with MRR – Review

  • CB Passive Income Review – A Fully Functional Free Version Included

    CB Passive Income Review – A Fully Functional Free Version Included

  • A Simple Way to Monetize your WordPress Blog – Content.Ad Review

    A Simple Way to Monetize your WordPress Blog – Content.Ad Review

  • The Bloggers Roadmap – Honest User Review

    The Bloggers Roadmap – Honest User Review

Recent Posts

  • How to Cancel All Friend Request Sent on Facebook in One Click

    How to Cancel All Friend Request Sent on Facebook in One Click

  • How to Auto Post Your Content to Facebook, Google+, Twitter and LinkedIn

    How to Auto Post Your Content to Facebook, Google+, Twitter and LinkedIn

  • Two Ways to Make YouTube Videos Responsive in WordPress

    Two Ways to Make YouTube Videos Responsive in WordPress

  • Subdomains vs Subfolders Usage Comparison

    Subdomains vs Subfolders Usage Comparison

  • How to Create Exit Intent Pop-ups Using Free Plugins

    How to Create Exit Intent Pop-ups Using Free Plugins

Affiliate Disclosure

While we receive affiliate compensation for reviews / promotions on this page, we always offer honest opinion, relevant experiences and genuine views related to the product or service itself. Our goal is to help you make the best purchasing decisions, however, the views and opinions expressed are ours only. As always you should do your own due diligence to verify any claims, results and statistics before making any kind of purchase. Clicking links or purchasing products recommended on this page may generate income for this website from affiliate commissions and you should assume we are compensated for any purchases you make.

About

  • About Me
  • Sign Up
  • Contact Me

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Disclaimer

Follow Me

Copyright © 2022 · Marketing With Vladimir

Get Comment Funnels For FREE (normally $197/m)

(Enter your name and email address below and click “Continue…” to complete)