How To Move WordPress Blog To Main Domain

Total
0
Shares
Move WordPress Blog to Main Domain

If you have a WordPress blog incorporated into a static site and now want to run the entire site on WordPress there are many options available. The most common use of WordPress is probably included on a static HTML site with WordPress installed in a directory called blog. After seeing the power and flexibility of WordPress many people want to ditch the old HTML files and run the site entirely on WordPress. There are several options to make this transition and the best method to do it depends on the current settings and your desired outcome. This particular guide will cover the most common situation.

Please read over and fully understand this entire Guide before Implementing!

What we are going to do is sort of, move the current blog to the main domain or directory, create a static front page for the blog on the main and the blog posts will still be in the /blog directory. This guide will assume you have a WordPress blog installed in a directory called /blog and you are using the postname in the permalink structure. The postname permalink structure is critical to maintaining your current blog’s permalinks (the URL’s of the posts). If you have WordPress installed in a differently named directory, other than /blog, just substitute it for blog throughout the transition. This guide is a bit advanced and assumes you have some basic knowledge of directories, FTP and how to edit files on your hosting account, so please don’t ask how to do those basic tasks in the comment section.

Initial Steps:

First things first and that is a complete backup of all critical files and the database. The only WordPress related files that you should backup on a regular basis are all in the wp-content folder, this has your plugins and themes but most importantly the uploads folder. The plugins could all be downloaded again, and if the theme is not edited or customized it too can be downloaded again as well. But all the images you might have uploaded into different posts are usually stored in the uploads folder. So good luck trying to restore those without a backup! So fire up your FTP client and browse to the WordPress files, and save the entire wp-content folder on your computer.

Backup Your Site:

Next is to backup the database, which is the most important thing to backup. The database holds all the content or the actual posts and settings. Keep in mind that the database will have the settings of the blog in its own directory at this point. So restoring the database with this version of the backup will undo what we are going to do and put it back into the old /blog directory. Got that? Good. There are several different ways to backup the database and since I and many others have written about it I am just going to refer you to those posts here:
Backup WordPress Database
Scheduled Backup Of Your WordPress Blog

So now that you have everything backed up and saved safe and secure on your computer its time to make the move. I cannot stress enough the importance of those backups and I will not be responsible for or will help you (for free) restore your lost WordPress blog or website! And once again this guide is for a very specific situation as stated above, any variation form those may not work for your situation.

Steps to Move The Domain:

Login to the WordPress dashboard and go to the Settings, General panel.

In the first box for WordPress address (URI): keep this as is, this is the location of your main WordPress core files. We can still keep these files in the /blog directory but still move the blog to the main domain.

In the box for Blog address (URI): change the address to the new location, which in this case will mean removing the trailing /blog and will be the main domain only. Scroll down and Save Changes and do not try to open or view the blog or click any other dashboard menus now! Do not worry about the error message you might see you will probably get a message about file not found.

Next, on the hosting account copy the index.php file, and if you have one the .htaccess from the /blog directory to the main directory. Now open (to edit) the index.php file you just copied into the main directory and add the /blog directory to the area below:

Change:
require('./wp-blog-header.php');
To:
require('./blog/wp-blog-header.php');

This is telling WordPress where the files are located which is the same location as the blog was original. Since the files are still in the same location, so too is the dashboard so you will still login to the dashboard at the same location as before the change.

Next is to rename the old index.html or index.htm files on the main domain or directory. These files will show the old site until renamed or removed. I suggest renaming them so they will still be visible online so you can use them to rebuild your new WordPress front page. So if you rename index.html to oldindex.html you can see it by its full address: www.yourdomain.com/oldindex.html. If you don’t see your WordPress blog on your main domain after these steps refresh your browser and or clear its cache.

Remember you want to maintain the old blog posts permalinks, and after the move, the posts are on the main domain without the /blog in the permalinks or URLs and are now broken. So you need to create a static WordPress front page for the site that will have the information similar to what was on the old HTML site. Go to Pages (not posts) and create a new page. Title the new page the same as your old static index.html page, and in the All In One SEO plugin module add the same keywords and description as well. Add the content to this page that you want to show on the site’s main domain. Publish the new page and then create another new page titled Blog, or the same title as the directory the WordPress blog was originally installed in. Add no content to this page and publish it blank.

Next go to Settings, Reading and choose the Static front page option, choose the new front page and the Blog page for the posts page and save changes. Then go to Settings, Permalinks and, without changing them, just click Save Changes to reestablish them once again. Now your old blog posts should be back on the same permalink or URLs as before the move.

Now you can use the WordPress dashboard to run your entire site and can edit the front page in the WordPress page editor. Keep in mind that all your old HTML pages can coexist with WordPress in any directory so you really don’t need to remove them and can keep them live.

I know this is a very long guide and the steps are very specific to this situation and desired outcome. So please be very careful, read over the guide first and make sure you understand what you are about to do before doing it.

Here are a few posts that will help after you make this move:
Create A Custom WordPress Static Front Page
Change Static HTML Page Into A WordPress Page
Remove Title From WordPress Page Template

Leave a Reply

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

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like