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:
- Login to Plesk
- Click the 1-click web apps button
- 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.
- Select the same domain as the destination and be sure to specify no path / subdirectory
- Proceed with the clone process.
- 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.
- 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.
- Open the httpdocs folder, then proceed to the folder to which you installed WordPress (probably something like /blog or /wordpress)
- Copy the index.php file to the parent directory (back one, to httpdocs).
- 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
- Be sure to save index.php in httpdocs
- Login to WordPress with your administrator user and go to Settings > General
- Remove the /wordpress (or /blog or whatever your installation folder is) from the end of “Site address (URL)” and Save Changes.
Congratulations! You should now find your WordPress install is accessible at http://yourdomain.com