How to Get Rid of /wordpress/ From your WordPress Site URL

How to Remove /wordpress/ From Your WordPress Site URL (2023 Guide)

Is your WordPress site‘s URL something like example.com/wordpress/ instead of just example.com? Having /wordpress/ in the URL is not ideal for several reasons:

  • It looks less professional and may be confusing or concerning to visitors
  • It can hurt your SEO as the URL structure appears less authoritative to search engines
  • It makes your URL longer and harder to remember
  • Issues can occur with some WordPress plugins and themes

Luckily, there are several ways to get rid of the /wordpress/ subdirectory and make your site accessible directly from your domain name. In this guide, we‘ll walk through why /wordpress/ ends up in the URL in the first place, and provide step-by-step instructions on how to remove it and set up proper redirects.

Feel free to use the links below to jump to a particular section:

  1. Why Your WordPress Site Has /wordpress/ In the URL
  2. Back Up Your WordPress Site
  3. Method 1: Change the WordPress Site Address
  4. Method 2: Manually Move WordPress to the Root Directory
  5. Method 3: Use the Duplicator Plugin to Move WordPress
  6. Set Up Redirects From /wordpress/ to the Root Domain
  7. Update Internal Links to the New URL Format
  8. Enable HTTPS on Your WordPress Site

But first, let‘s understand a bit more about how WordPress ended up in a subdirectory to begin with.

Why Your WordPress Site URL Has /wordpress/ In It

Most often, /wordpress/ appears in the URL because of the way WordPress was initially installed.

When you download the WordPress software from WordPress.org, it comes in a compressed ZIP file. Once extracted, all of the WordPress files are contained inside a directory named "wordpress".

For WordPress to work properly, all of those files need to be uploaded to your web hosting server. Some users mistakenly upload the entire "wordpress" directory to their server, instead of just the files inside it.

If WordPress is installed this way, the site will only work when accessed through the /wordpress/ subdirectory, which becomes part of the URL.

Another possible reason is that the person who installed WordPress (possibly your web developer) purposely chose to put WordPress in a subdirectory, either for security or to keep it separate from other applications running on the same domain.

Regardless of how it happened, let‘s look at how to remove the /wordpress/ subdirectory from your site and fix your URLs.

Back Up Your WordPress Site

Before attempting any of the methods below, it‘s very important to fully back up your WordPress site. Whenever you make significant changes to your site‘s URLs or file structure, there is a chance that something could go wrong.

Having a complete backup ensures that you can always restore your site back to normal if you encounter any issues. See this guide to WordPress backups for full step-by-step instructions.

Once your backup is complete, you can proceed with removing /wordpress/ from your site‘s URL. Here are three methods you can use:

Method 1: Change the WordPress Site Address

Difficulty: Easy
Effectiveness: Removes /wordpress/ from frontend URLs only

The easiest way to get rid of the /wordpress/ subdirectory is to change your WordPress site address.

In your WordPress dashboard, go to Settings > General. You will see two fields at the top:

  • WordPress Address (URL): This is the location of your WordPress core files.
  • Site Address (URL): This is the public URL you want people to use to access your site.

In most cases, both fields contain the same URL. But you can edit the Site Address to remove the /wordpress/ subdirectory while still leaving your WordPress files in that location.

For example:

WordPress Address (URL): https://example.com/wordpress
Site Address (URL): https://example.com

All links on your site will now use the root domain URL without the /wordpress/ subdirectory.

Be aware that this method has some drawbacks:

  • While the /wordpress/ subdirectory is stripped from public URLs, your WordPress dashboard will still be located at example.com/wordpress/wp-admin/
  • Your WordPress files are still located in the /wordpress/ subdirectory, so the potential remains for URLs to include /wordpress/ in some cases
  • Media file URLs may still contain the /wordpress/ subdirectory

Because of these issues, this method is not recommended for most users. It‘s a fast way to remove /wordpress/ from public URLs, but doesn‘t fully solve the problem.

For a more complete solution, use method 2 or 3 below.

Method 2: Manually Move WordPress to the Root Directory

Difficulty: Advanced
Effectiveness: Removes /wordpress/ from all URLs

Moving WordPress out of the /wordpress/ subdirectory to your server‘s root directory will completely remove /wordpress/ from all URLs on your site. This method requires using FTP to edit the files on your server.

Here are the steps to manually move WordPress:

Step 1: Connect to your server via FTP and download the /wordpress/ directory to your computer.

Step 2: Copy the index.php and .htaccess files from the /wordpress/ directory to the root directory of your server.

Important: If you already have an index.php or .htaccess file in your root directory, do not overwrite them. Instead, edit the existing index.php file (see step 3) and copy any custom rules from your existing .htaccess file to the one in /wordpress/.

Step 3: Edit the index.php file in the root directory and change this line:

require( dirname( FILE ) . ‘/wp-blog-header.php‘ );

to this:

require( dirname( FILE ) . ‘/wordpress/wp-blog-header.php‘ );

Step 4: Copy all the files inside the /wordpress/ directory on your computer to the root directory of your server.

Step 5: Delete the now-empty /wordpress/ directory on your server.

Your WordPress site should now load from the root domain without the /wordpress/ subdirectory. But there are still a couple of things we need to do:

Step 6: Update your WordPress site URL in the database. In your WordPress dashboard, go to Settings > General and change both the WordPress Address (URL) and Site Address (URL) fields to your root domain URL.

Step 7: If you have any hardcoded links in your theme files, plugins, or content that contain the old /wordpress/ URL, you‘ll need to update them to the new URL format. See the "Update Internal Links" section below for more details.

Finally, it‘s important to set up redirects from the old /wordpress/ URLs to your new root domain URLs. That way, any visitors clicking on an old link to a page like example.com/wordpress/some-post/ will automatically be redirected to example.com/some-post/. See the section on setting up redirects below.

Moving WordPress manually can be tricky and time-consuming, especially if you‘re not very technical. If you‘re not comfortable editing files on your server, you may want to try using a plugin instead.

Method 3: Use the Duplicator Plugin to Move WordPress

Difficulty: Easy
Effectiveness: Removes /wordpress/ from all URLs

For a simpler way to move WordPress out of a subdirectory, you can use the free Duplicator plugin. Duplicator lets you migrate your entire WordPress site, including moving it from a subdirectory to the root directory, with just a few clicks.

Here‘s how to use Duplicator to remove /wordpress/ from your site‘s URL:

Step 1: Install and activate the free Duplicator plugin on your WordPress site.

Step 2: Go to Duplicator > Packages and click the "Create New" button.

Step 3: Click "Next" to have Duplicator scan your site and create a package containing all your WordPress files and database.

Step 4: Once the package is complete, download the Installer and the Archive files to your computer.

Step 5: Delete all files from the root directory of your website. This is important to avoid conflicts between your existing WordPress files and the new files Duplicator will install.

Step 6: Upload the Installer.php file and the Archive.zip file from Duplicator to the now-empty root directory.

Step 7: Visit http://example.com/installer.php in your browser to run the Duplicator installer wizard.

Step 8: On Step 1 of the wizard, click "Next" to have Duplicator extract the Archive.zip file.

Step 9: On Step 2, enter your WordPress database details in the "New Database" section. You can get this information from your web hosting control panel.

Step 10: Also on Step 2, change the "New URL" field to your root domain name. This tells Duplicator to remove /wordpress/ from all URLs in the database.

Step 11: Complete the remaining steps and log in to your WordPress dashboard. Duplicator will automatically log you out and back in to complete the migration.

That‘s it! Your WordPress site should now be fully moved to the root directory and accessible without the /wordpress/ subdirectory.

The only remaining step is to set up redirects from your old /wordpress/ URLs to the new root domain URLs.

Set Up Redirects From /wordpress/ to the Root Domain

Whenever you change the URL structure of your site, it‘s very important to set up proper redirects from the old URLs to the new ones. This has two big benefits:

  1. Redirects ensure that any visitors who land on an old /wordpress/ URL will automatically be sent to the correct page on your site. Without redirects, they would see a 404 error page instead.

  2. Redirects preserve your SEO by telling search engines that your content has permanently moved to a new location. This ensures you don‘t lose any hard-earned keyword rankings when changing your URLs.

There are two ways to set up the necessary redirects: using .htaccess or a WordPress plugin.

Redirects With .htaccess

If you have access to your site‘s .htaccess file, you can set up redirects by adding the following code at the very top of the file:

RewriteEngine On
RewriteRule ^wordpress/(.*)$ https://example.com/$1 [R=301,L]

Replace example.com with your own domain name.

This rule will redirect all URLs that start with /wordpress/ to the same URL path on your root domain. For example:

Old URL: https://example.com/wordpress/sample-post/
Redirects to: https://example.com/sample-post/

Redirects With Plugin

If editing .htaccess is not an option, you can use the free Redirection plugin instead.

After installing and activating the plugin, go to Tools > Redirection to set up a new redirect.

In the "Source URL" field, enter /wordpress/(.*)

In the "Target URL" field, enter https://example.com/$1

Then click "Add Redirect" to save your changes.

The redirect rule will work the same as the .htaccess method described above, sending all /wordpress/ URLs to the same path on your root domain.

Update Internal Links to the New URL Format

In addition to setting up external redirects, it‘s important to update any internal links on your site that may still be using the old /wordpress/ URL format.

To do this, install and activate the free Better Search Replace plugin. Then go to Tools > Better Search Replace.

In the "Search for" field, enter https://example.com/wordpress/

In the "Replace with" field, enter https://example.com/

Then click "Run Search/Replace" to update all instances of the old URL format in your database.

Be aware that this will only update URLs that are stored in the WordPress database, such as links in posts, pages, navigation menus, etc. If you have any hardcoded links in your theme files or plugins, you will need to update those manually.

Enable HTTPS on Your WordPress Site

If your site doesn‘t yet have an SSL certificate, it‘s a good idea to enable HTTPS at the same time you remove /wordpress/ from your URL. This will ensure your site is fully secured and prevent having to change all your URLs a second time.

Enabling HTTPS is simple with the free Really Simple SSL plugin:

Step 1: Get a free SSL certificate from Let‘s Encrypt or your web hosting provider.

Step 2: Install and activate the Really Simple SSL plugin.

Step 3: On the SSL settings page, verify that your SSL certificate is correctly detected. Then select the "Activate SSL" option.

The plugin will automatically update your site to use HTTPS and ensure that all http:// pages redirect to their https:// equivalent.

Removing /wordpress/ From Your Site URL: Final Thoughts

No matter how the /wordpress/ subdirectory ended up in your WordPress site‘s URL, removing it and changing your site to load from the root domain is almost always a good idea.

The main benefits are:

  • Shorter, simpler, more professional-looking URLs
  • Better branding and credibility with visitors
  • Improved SEO due to a cleaner site structure
  • Full compatibility with all WordPress plugins and themes

To remove /wordpress/ from your URLs, the best option for most users is Method 3: running a full migration with the Duplicator plugin. This will ensure your entire site is moved properly and no data is lost in the process.

Once your migration is complete, don‘t forget to:

  • Set up 301 redirects from your old /wordpress/ URLs to the new root domain URLs
  • Update any internal links in your content still using the old URL structure
  • Enable HTTPS for maximum security and to avoid having to change URLs again

By following this guide, you can fix the appearance and functionality of your WordPress site by getting rid of the pesky /wordpress/ subdirectory. Your visitors will thank you and your site will be in a better position to grow and succeed for the long term.

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.