Moving WordPress from Sub-Directory to Root Directory EASILY
Moving WordPress from Sub-Directory to Root Directory
Reasons why Sub-Directory is used in website development
- Many clients want developer to show mockup website design or demo of the website ,so Sub-Directory or subdomain is mostly used by web developer .so if you are web developer you must have already installed WordPress website,HTML,PHP,ETC on Sub-Directory or subdomain
- Sub-Directory WordPress website doesnt interfere with LIVE site .so even if there are 1ooo errors on the Sub-Directory say www.XYZ.com/wp ,still the LIVE site say www.XYZ.com will be without any error
- Sub-Directory WordPress website helps you add user defined path instead of default WordPress login path ,so if default WordPress login path is say www.XYZ.com/wp-login.php which any HACKER can easily guess and can easily HACK your website .To avoid that you can always install WordPress website in a Sub-Directory say www.XYZ.com/xqsa .So your login path will give you extra security.
Follow below wordpress tutorial for Moving WordPress from Sub-Directory to Root Directory easily –
Suppose you have made Sub-Directory wp for developing a new WordPress website at say for example www.XYZ.com,so the full path of your new WordPress website along with Sub-Directory will be www.XYZ.com/wp where wp is the name of Sub-Directory where we have installed new WordPress website.
Its very easy to move WordPress website installed at www.XYZ.com/wp where wp is the name of Sub-Directory to the root which is say www.XYZ.com here.
Step 1-Turn off Permalinks
To start you will have to go to Settings > Permalinks of this WordPress www.XYZ.com/wp
Next choose Plain radio button to turn off Permalinks
Click the Save changes button and move on to the next steps
Below image example shows how to choose Plain radio button to turn off Permalinks in https://localhost/ localhost environment
Step 2-Change Site Address (URL) only
Next go to Settings > General, change the address of your Site Address (URL) but keep the address of WordPress address (URL) unchanged. For example,
By default it will be shown as below
- WordPress address (URL): www.XYZ.com/wp
- Site Address (URL): www.XYZ.com/wp
After Changing above Site Address (URL) www.XYZ.com/wp to www.XYZ.com you will get below
- WordPress address (URL): www.XYZ.com/wp
- Site Address (URL): www.XYZ.com
Below image example shows how to change Site Address (URL)
Click the Save changes button and move on to the next steps
Step 3-Copying index.php,.htaccess Files to the root directory
Next using FTP or CPanel file manager, copy (don’t move) the following files from your WordPress sub directory i.e wp to the root directory:
index.php
.htaccess
, if you have one. If there isn’t an.htaccess
file (and the fact that you’ve turned off pretty permalinks means you’re less likely to have one), don’t worry about creating one—just skip this step.
Step 4-Editing index.php Files
Must Read wordpress Tips of this Years -> https://share-ask.com/?s=wordpress
Next Edit the file index.php which you’ve just copied in to the root directory in the above step
Now only edit you need to make is to find one line at the end of the file as shown in the bold text below
VIDEO HELP for Moving WordPress from Sub-Directory to Root Directory
Let us know if you have doubts we will solve ASAP