Installing WordPress is straightforward, but many beginners accidentally set it up in a subdirectory like https://www.example.com/wordpress/ instead of the root domain https://www.example.com. If that's your situation and you want to shift everything to the root, this proven guide will help you eliminate the /wordpress/ from your URL seamlessly.
Note: This process works for any subdirectory name, not just /wordpress/.
If your site has no content yet, simply delete the current installation and reinstall WordPress in the root directory using our comprehensive WordPress installation tutorial. For live sites with content, follow the steps below.
Log into your WordPress dashboard and head to Settings » General. You'll see WordPress Address (URL) and Site Address (URL) fields, both pointing to your subdirectory. Change only the Site Address (URL) to your root domain (e.g., https://www.example.com) and leave WordPress Address (URL) as is. Click Save Changes.

Next, connect to your server via an FTP client like FileZilla. Navigate to the /wordpress/ directory and download .htaccess and index.php to your desktop.
.htaccess is a hidden file, so it might not appear by default. In FileZilla, go to Server » Force showing hidden files to reveal it.

Open index.php in a plain text editor like Notepad. Find this line:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
Replace it with:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
This points to the core WordPress files in the subdirectory. Save the file, then upload both index.php and .htaccess to your site's root folder (typically /public_html/ or /www/).

That's it! Your site now loads cleanly from the root domain. To access the admin area, use https://www.example.com/wordpress/wp-admin.
This method has helped thousands of sites migrate smoothly without data loss. Questions? Drop a comment below.