WordPress is very easy to install however sometimes beginners end up installing WordPress in a subdirectory instead of the root directory of their website, e.g.
http://www.example.com/wordpress/ instead of
http://www.example.com. If you accidentally installed WordPress in a subdirectory and now want to move it to the root directory, then you’re in the right place. In this article, we will show you how to get rid of /wordpress/ from your site’s URL.
Note: The method shown in this tutorial works for other subdirectories as well.
If you have not uploaded any content to your site, then you can delete the existing WordPress install and start over by following our complete WordPress installation tutorial. However, if you already have your site up and running, then continue reading.
First you need to log in to your WordPress site’s admin area and go to Settings » General. On the settings page, you will see WordPress Address and Site Address fields and both will have the same URL. You need to change the Site Address option to point to your root domain, e.g. http://www.example.com and leave WordPress Address option as it is. Once you do that, click on Save Changes button to store your settings.
Next, you need to connect to your website using a FTP client. Once you are connected, go to the
/wordpress/ directory and download the
index.php files to the Desktop on your computer.
It is possible that you may not see
.htaccess file in your /wordpress/ directory because it is a hidden file, and your FTP client may not show it. To see the hidden file, you need to enable showing hidden files option in your FTP client. If you are using Filezilla, then you need to click on Server from the menu bar and select ‘Force Showing Hidden Files’ option.
Once you have downloaded both files to your Desktop, you need to open
index.php file in a text editor like Notepad. In this file you will find a line like this:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
This line loads
wp-blog-header.php file, which is required to load the front-end of your WordPress site. What you need to do now is enter the correct location of the file by replacing the existing line with this one:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
Save your changes and upload both
.htaccess files from your desktop to the root of your domain using FTP. The root folder is the parent folder with the wordpress folder inside it usually called /www/ or /public_html/
That’s all. You can now visit your website on your main domain, and everything will work fine. However, if you need to login to your WordPress admin, then you will still need to go to the wp-admin inside the wordpress directory like this:
We hope that this tutorial helped you get rid of /wordpress/ from your site’s URL. For feedback and questions leave a comment below.