If you installed WordPress into a subdirectory or subdomain but would now like to start using WordPress for the main part of your site, you have two options. You can either move WordPress from the subdomain or subdirectory into the document root of your site or you can reconfigure WordPress to run from the main part of the site but keep the files in that subdomain or subdirectory folder.

Of note, this will work for any type of hosting, but WordPress Hosting is best for a WordPress site as the server is optimized specifically for WordPress. (Of note, Web Hosting Hub is recommended by BoldGrid as a top WordPress Web Hosting provider.)

In this article we'll show you the changes needed to keep most of the WordPress files in their existing folder, but use WordPress for the main part of your site.

  1. Begin by logging into your WordPress dashboard.
  2. In the WordPress menu (on the left side of the page) navigate to Settings > General and change the Site Address (URL) to your main domain name (e.g. http://yourdomain.com). Leave the WordPRess Address (URL) as it is, it should not be changed. Click the Save Changes button at the bottom of the page. Don't worry if you see an error message, and do not try to view your site just yet (you'll likely get an error message there too).
  3. Log out of your WordPress dashboard.
  4. Using either the cPanel File Manager or a stand alone FTP program, COPY the index.php and .htaccess files from the subdomain or subdirectory into the site's document root folder. This will be public_html for the account's main domain name, while Addon domains be something similar to public_html/addondomain.com. Make sure you copy these files, do not move them.
  5. In the cPanel FIle Manager, open your index.php file that you just copied to public_html to edit it. You can open the file for editing by clicking on the file and then selecting Code Edit or Edit in the menu at the top of the page or right clicking the file and selecting either Code Edit or Edit in the menu that appears. If you receive an Encoding Check pop up window, make sure utf-8 is selected as the character encoding.
  6. Near the end of the file, locate the line that reads:

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

  7. Edit this to point to the directory where you originally installed WordPress (e.g. /blog/wp-blog-header.php:

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

  8. Now you're ready to log back into your WordPress dashboard once again. The link to wp-admin will not change from the original (e.g. blog.yourdomain.com/wp-admin or yourdomain.com/blog/wp-admin).
  9. If you are using Permalinks, navigate to Settings > Permalinks. Change your Permalinks to any other setting and click the Save Changes button. Now change them back to your preferred Permalinks structure and click Save Changes again. This will reset your Permalinks so all of your site's links should be updated now.

Now you can navigate to your domain name in your browser to see your WordPress site.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Comments

n/a Points
2014-10-28 12:30 pm

Hello! I was following these instructions and accidentally changed the Wordpress URL adress as well - and now I can't go back to the new site's admin panel at all anymore - is there a way to undo it??

 

Staff
2,342 Points
2014-10-28 3:48 pm
To correct your WordPress URL, you may simply add these lines to your wp-config.php file using the cPanel File Manager:

define('WP_HOME','http:/example.com/');
define('WP_SITEURL','http://example.com');



Of course, adjust these lines to correctly reflect your WordPress URL and site URL.
n/a Points
2014-11-20 5:04 am

Hi, I can get this to work with a subdirectory but I'm having trouble getting it to work with a subdomain. I think the problem is how I reference the subdomain in index php.. WordPress is looking for the files in the root domain while they are in their own root folder on the server.. How do I tell wp to go to server root instead of the main site root? This doesn't work:

require('./sub-domain/wp-blog-header.php');

 

/pete

Staff
17,314 Points
2014-11-20 7:43 am
Hello Pete,

Sorry for the problem. The instructions above should allow you to change the URL so that you can use location of your subdomain. Make sure to check that you do not have a re-direct rule that is affecting your domains in your .htaccess file. If you are a customer of Web Hosting Hub, please provide us a URL and we can check this for you.

Kindest regards,
Arnel C.
n/a Points
2015-05-20 10:02 am

I've done this switch but some of my theme images aren't working (drop-down icons/arrows, social media profile icons, etc). Any idea why this would be?Also is this method okay for SEO too - feels a bit like it could get complicated later on?

Staff
17,314 Points
2015-05-21 6:18 pm
Hello Matt,

I'm sorry to hear that you're having problems with the switch. Typically, it's because the change in path hasn't been applied to everything within the site. Plug-ins, themes may not like the switch provided by this method. If you want a more thorough way of doing this, then you would need to physically MOVE the installation to the new locations, and then adjust all of the files. Check out Moving WordPress. Making the move would also ensure no future issues with SEO, etc.

I hope this helps to answer your question, please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2015-05-22 8:17 am

Thanks a lot for the help Arnel!I think it would be much better to move the whole site now. Will there be additional tasks if following your link - eg changing the index.php line of code back to the original?

Staff
12,339 Points
2015-05-26 11:57 pm
Hello Matt,

Thank you for contacting us. Yes, I would revert back any changes made in the above guide, and test the site successfully first. Then, proceed to the next link.

Thank you,
John-Paul
n/a Points
2015-06-11 10:50 pm

Howdy!!

Quick question. What if I have a bunch of subdirectory folders. Each one set up with it's own WP theme. (all different sites. My client set it up like this on his server, so there isn't a particular site in the root folder, all sites have their own folders on the server).

I just created a new wordpress site in a subdirectory from the root, while the current wp site is still active in it's own subdirectory folder.

How would I go about switching over to the new subdirectory folder once I have completed the new site?

 

Hit me up with questions if I haven't been clear.

 

Thanks!!

Tara

Staff
12,339 Points
2015-06-11 11:20 pm
Hello Tara,

Thank you for contacting us. The guide above still applies in your situation. Every site on the server will have its own Document root, or folder that stores the files for your website.

COPY the index.php and .htaccess file (Step 4 above) for the site you created, into the document root.

Just be sure to set the correct directory location (for the site you created), in Step 7 above.

Thank you,
John-Paul
n/a Points
2016-11-24 12:21 pm

Step 5. In the cPanel FIle Manager, open your index.php file that you just _MOVED_ to public

Should be 'copied' not 'moved'?

Staff
12,339 Points
2016-11-24 7:34 pm
Thank you for pointing out the typo. I have updated the article as needed, it may take some time to clear the server cache and display.

Thank you,
John-Paul
n/a Points
2016-12-22 1:43 am

Great guide! Everything worked except I cannot access the wp-admin on the subdomain URL. Any suggestions?

Staff
17,314 Points
2016-12-22 2:20 am
Hello Akif,

Sorry for the problem with logging into Wp-admin. You will need to reset your password if you're having problems with the login due to a password issue. You can use this guide from the WordPress Codex to help with recovering your password. If you're seeing something else, such as an error, we would need to know what error you're having so that we can try to resolve it. You may want to contact our live technical support for Web Hosting Hub via chat/phone/email (or Skype).

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2016-12-22 7:19 pm

Hi Arnel,

Thanks for getting back to me. The wp-admin is just not accessible anymore. The page gives an error "the page isn't redirecting properly". It seems that somehow the admin part is also getting redirected along with the front end website.

Staff
12,339 Points
2016-12-22 9:02 pm
First I recommend checking your .htaccess file. One of the first steps you can do when troubleshooting .htaccess errors is to try renaming the .htaccess file. If this resolves the error, then you know it's something in the .htaccess file. If it doesn't resolve the issue, simply change the name back to .htaccess.

If your problems persist, I recommend following our WordPress Troubleshooting guide.

Thank you,
John-Paul

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}