How to make WordPress not appear like it’s in a subfolder

This article shows you how to ensure visitors reaching your website will see your WordPress website when it’s installed to a subdirectory like /wordpress or /blog. If you’re looking for information no how to install WordPress, we’ve got a great detailed guide for creating a WordPress blog right here!

If you’ve installed WordPress to a subdirectory like /blog or /wordpress, that means it must be accessed by going to yourdomain.com/blog or yourdomain.com/wordpress. But now you want your WordPress website to be shown to visitors without having to put in /blog or /wordpress after your domain! There’s a couple ways to do this…

Solution 1: Move WordPress to the root (Clone)

The cleanest way to resolve this is to use our 1-click web apps utility to clone WordPress into the root, then remove the original installation (the one in the subfolder). If you prefer the folder structure remain as it is (perhaps you like a clean web root!) then skip on down to Solution 2 below. If you’re indifferent, then we suggest implementing this solution:

  1. Login to Plesk
  2. Click the 1-click web apps button
  3. Find your WordPress installation in the list of installed apps, then click the button that says Clone when you hover over it. It looks like two side-by-side arrows pointing downward.
  4. Select the same domain as the destination and be sure to specify no path / subdirectory
  5. Proceed with the clone process.
  6. Once completed, check to be sure you can load your website without the subdirectory.

You’ll now see two installations of WordPress in the 1-click web apps list of installed applications. Run a backup of the old installation (in the subdirectory) then remove it by clicking the X button.

It’s important to remove the old installation for security reasons as well as to be sure that there’s nothing still relying upon the files in the subdirectory. Better to know now than it is to be unsure why there’s issues months from now!

Solution 2: Load WordPress from the subfolder

Note: do not leave multiple copies of the same site running at the same time unless they are entirely separate (different subdomains, for example). Doing so will only make things really really confusing and 1-click web apps will more than likely cause problems with this set-up during updates. Be sure that if you use this solution, it is only in the case where you’ve got a singular WordPress installation.

The following steps will show you how to set up WordPress so that it can be accessed at www.domain.com (without the subdirectory) without cloning WordPress to the root of your domain, thus allowing you to leave it in its current subfolder.

When you’re working with your primary domain’s web files (whether using the Plesk File Manager or FTP), the ‘root’ or ‘web root’ is everything within the folder called httpdocs. If this is an add-on domain, then the web root was defined by you when you initially created it — most likely it’s a folder with the same name as the domain. We’ll be referring to your webroot as “httpdocs” below, so if you’re using an add-on domain, be sure to replace that reference with your actual web root folder.

  1. If you know your FTP login details, login via SFTP or FTPS. If not, it’s simpler to use the Plesk File Manager. This is done by logging in to Plesk, then clicking on “Files” in the main menu.
  2. Open the httpdocs folder, then proceed to the folder to which you installed WordPress (probably something like /blog or /wordpress)
  3. Copy the index.php file to the parent directory (back one, to httpdocs).
  4. Edit the index.php that you moved to the web root and change the line that says require(‘./wp-blog-header.php’); to require(‘./wordpress/wp-blog-header.php’); If you used something other than “wordpress” as your subfolder installation directory/path (like ‘blog’), then place that folder name between the slashes instead
  5. Be sure to save index.php in httpdocs
  6. Login to WordPress with your administrator user and go to Settings > General
  7. Remove the /wordpress (or /blog or whatever your installation folder is) from the end of “Site address (URL)” and Save Changes.
WARNING: Do NOT change the WordPress address (URL) setting. That setting MUST continue to have the full install path. Be sure to only change the “Site address” value

Congratulations! You should now find your WordPress install is accessible at http://yourdomain.com

Jordan is a computer, security, and network systems expert and a lover of all things web and tech. Jordan consults with project management for software companies. Jordan is a founder and managing partner at Websavers Inc.

4 Comments

  1. Erik Lee on May 14, 2017 at 9:19 am

    i think the new index.php is
    require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );

    so where do we insert the ‘mysubfolder’ in the above line?

    • Jordan Schelew on May 14, 2017 at 9:26 am

      Hey Erik,

      dirname(__FILE__) simply means the current directory of index.php, so you’d do: require( dirname( __FILE__ ) . '/mysubfolder/wp-blog-header.php' );

  2. Richard Browning on May 6, 2017 at 7:35 am

    Thank you Jordan,

    I used your Method 2 and it worked well for me, unlike several other different methods that I saw on other websites.

    In my case, there was a file called “default.htm” in the root directory, which was there as part of a new hosting account. I renamed that to “default-old.com”, and my WordPress site looked like it was installed in the root directory, as desired.

    • Jordan Schelew on May 6, 2017 at 6:37 pm

      Hey Richard; that’s great to hear! And yes that’s a great addition in that index file extension order of processing could definitely also be problematic after getting the index.php file in place. Thanks!

Leave a Comment