How to Remove “wordpress” From Your Site URL
If your WordPress site’s URL contains “wordpress” (e.g., yourdomain.com/wordpress), it likely means that WordPress was installed in a subdirectory instead of the root folder. Removing “wordpress” from your site URL can help make your website look cleaner and more professional. Fortunately, you can do this without reinstalling WordPress.
Here’s a step-by-step guide to remove “wordpress” from your site URL.
Step 1: Backup Your Website
Before making any changes to your WordPress site, it’s crucial to back up your website, including your files and database, to avoid any potential issues. You can use plugins like UpdraftPlus or your hosting provider’s backup tool.
Step 2: Move WordPress Files to the Root Directory
If WordPress is installed in the /wordpress subdirectory, you’ll need to move the files to the root directory of your site (e.g., public_html). This process involves copying WordPress files from the subfolder to the root without reinstalling the CMS.
Steps:
- Access your web server:
- Use an FTP client like FileZilla or log in to your hosting account’s File Manager.
- Navigate to the subdirectory:
- Find the wordpress subdirectory (e.g., yourdomain.com/wordpress) in your hosting’s public_html folder.
- Move the WordPress files:
- Copy all the files inside the /wordpress folder (but not the folder itself) to the root directory (public_html).
- Make sure to include hidden files like .htaccess.
Important: Do not delete the original files yet. Copy them first to ensure the transition works smoothly.
Step 3: Change the WordPress URL and Site Address
Once you’ve moved the files, you’ll need to update your WordPress Address (URL) and Site Address (URL) in the WordPress dashboard to remove “/wordpress” from the site URL.
Steps:
- Log in to your WordPress dashboard.
- Navigate to Settings > General.
- Update the following fields:
- WordPress Address (URL): Change from https://yourdomain.com/wordpress to https://yourdomain.com.
- Site Address (URL): Change from https://yourdomain.com/wordpress to https://yourdomain.com.
- Click Save Changes.
Step 4: Update Your Permalinks
After moving the files and updating the URLs, you’ll need to refresh your permalinks to ensure all links work correctly on your site.
Steps:
- Go to Settings > Permalinks in your WordPress dashboard.
- Without changing anything, click Save Changes to refresh your permalink structure.
Step 5: Check and Update Internal Links and Media
After moving your site and changing the URLs, some internal links (e.g., images, media files, internal page links) might still contain the old /wordpress URL. Use a plugin like Better Search Replace to quickly find and replace any instances of /wordpress in your database.
Steps:
- Install and activate the Better Search Replace plugin.
- Go to Tools > Better Search Replace.
- In the Search for field, enter /wordpress.
- In the Replace with field, enter just /.
- Select the database tables you want to update (usually, all tables related to WordPress).
- Run the search and replace.
Step 6: Update Your .htaccess File
Your .htaccess file is responsible for redirecting requests on your server. If you moved the files manually, the .htaccess file might need updating.
Steps:
- Access your server via FTP or File Manager.
- Locate the .htaccess file in the root folder (public_html).
- Ensure it includes the correct WordPress rewrite rules:# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
- Save and close the .htaccess file if any changes were made.
Step 7: Test Your Website
Once all the steps are complete, test your website thoroughly to ensure everything works as expected.
What to check:
- Visit your site using the new URL (e.g., https://yourdomain.com) and ensure that all pages load properly.
- Check your internal links, images, and media to verify that no URLs point to the old /wordpress path.
- Ensure that your admin dashboard is accessible at https://yourdomain.com/wp-admin.
Step 8: Set Up 301 Redirects (Optional)
If your site has been live for a while with the /wordpress URL, it’s a good idea to set up 301 redirects to ensure that any visitors using the old URL are redirected to the new one.
Steps:
- Open the .htaccess file located in the root folder.
- Add the following redirect rule:Redirect 301 /wordpress/ https://yourdomain.com/
- Save and close the file.
This will ensure that anyone visiting https://yourdomain.com/wordpress will be automatically redirected to https://yourdomain.com.
Conclusion
Removing “wordpress” from your site URL is a straightforward process that enhances the professional appearance of your website. By moving the files from the subdirectory to the root folder, updating your WordPress settings, and ensuring your URLs are correct, you can make this change seamlessly. Just be sure to back up your website before making any changes, and follow each step carefully to avoid any downtime or broken links.