Moving a wordpress website from a subdirectory to the root (/public_html) directory

Login to the Cpanel

Move the files from the sub directory to the root (/public_html)

Select all files in the subdirectory

Click Move

 

 

Login to admin dashboard

www.mywebsite.com/wp-admin/

Go to the settings

Click on Permalinks

Click Save

This will rewrite url in the .htaccess

Install the Velvet Blues Update URLs plugin

Go to Tools

Click Update URLs

Under old URL write the url with the subdirectory

Under new URL write the url without subdirectory

Make sure to not include / at the end of the url

Do not click the Update all GIUDs

Click Update URLs Now

The plugin may miss a few updates in some areas – just check the following areas

Click on Appearance

Click on the Menu

Update the any custom url that not have been updated by the plugin

Go to Appearance

Click on the Theme Options

Check the URL of the uploaded content and update all the url removing the subdirectory

Go to Sliders

Check and update any URL that may still have the subdirectory –such as logo, images,

 

Reset the Cache – if you have any cache plugin – make sure you clear the cache

 

Check if the website is now working well.

To avoid losing SEO gains from the old website, set up .htaccess  and write the following

RewriteEngine On

RewriteCond %{HTTP_HOST} ^mydomain.com/subdirectory$ [OR]

RewriteCond %{HTTP_HOST} ^www.mydomain.com/subdirectory$

RewriteRule (.*)$ http://www.mydomain.com/$1 [R=301,L]

 

Make sure the format of the RewriteRule (with www or without www) is the same as set under Settings, General

 

 

Leave a Reply

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

WhatsApp Truehost Kenya