8.3 C
London
Friday, April 19, 2024

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

Date:

Related stories

WHO hosts the first forum on traditional medicine

The World Health Organization will convene its first summit...

Despite profit-taking, the price of oil still records a weekly rise

As the dollar rose and oil speculators took profits...

Kenya bans churches after allegations of killing worshipers who were starved

According to a government document made public on Friday,...

Are you attempting to remove /wordpress/ from the URL of your website? Beginners frequently install WordPress in a subdirectory, resulting in the presence of /wordpress/ in the URL of their website.

You’ve come to the right place if you installed WordPress in a subdirectory by mistake and want to move it to the root directory. We will show you how and when to remove /wordpress/ from your WordPress site’s URL in this article.

Note that the method demonstrated in this tutorial also works for other subdirectories.

Why is there a /wordpress/ in the URL of your WordPress site?

WordPress is simple to set up, and most WordPress hosting companies now include quick WordPress installers in their control panels.

However, some beginners who install WordPress manually may unknowingly install it in a subdirectory. The most common name for this subdirectory is wordpress.

This occurs primarily as a result of users accidentally uploading the wordpress folder from the official WordPress.org download.

Let’s look at how to quickly fix this and remove the /wordpress/ prefix from your site’s URL.

/wordpress/ is being removed from the WordPress Site URL.

If you’ve just installed WordPress and don’t have any content on your site yet, you can simply start over.

To properly reinstall WordPress, simply delete the current installation and follow the instructions in our WordPress installation tutorial.

There are two simple ways to remove the /wordpress/ from your website’s URL if you have already added content.

Method 1: Modify the WordPress URL

This method is easier and faster if you already have a WordPress site. The disadvantage of this method is that your media files, such as images, will continue to use the /wordpress/ prefix in their URLs.

To begin, go to the Settings » General page in the admin area of your WordPress site.

You’ll notice that both the ‘WordPress Address’ and the ‘Site Address’ fields have the same URL.

Change the Site Address option to your root domain, for example, http://www.example.com, and leave the WordPress Address option alone.

After that, click the Save Changes button to save your changes.

The next step is to use an FTP client to connect to your website. Go to the /wordpress/ directory and save the.htaccess and index.php files to your computer once you’ve connected.

Read Also  Seven Best Customer Reviews Plugins for WordPress

If you can’t find the.htaccess file, you might have to tell your FTP client to show hidden files. If you’re using Filezilla, go to the menu bar, select Server, and then the ‘Force Showing Hidden Files’ option.

Once both files have been downloaded to your desktop, open the index.php file in a text editor such as Notepad. A line like this can be found in this file:

  1. require( dirname( __FILE__ ) . '/wp-blog-header.php' );

This line activates the wp-blog-header.php file, which is required for your WordPress site to function.

Now you must replace the existing line with the following one to enter the correct file location:

  1. require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );

Save your changes and use FTP to upload the index.php and.htaccess files from your desktop to the domain’s root directory. The parent folder is usually called /www/ or /public Html/, and it contains the wordpress folder.

That is all there is to it. Everything should now work when you visit your website using the root domain. If you need to access your WordPress admin, you’ll need to navigate to the wp-admin directory within the wordpress directory, as shown here:

http://www.example.com/wordpress/wp-admin

Method 2: Move WordPress to the root directory

This technique is much more detailed and will move your WordPress site completely from the subdirectory to the website’s root folder.

Step 1: Create a Duplicator Package.

The Duplicator plugin must first be installed and activated on your website. See our step-by-step guide to installing a WordPress plugin for more information.

After you’ve activated Duplicator, go to the Settings page and click the ‘Create New’ button.

This will activate the Duplicator wizard, which will generate an installer package for your entire website. To continue, click the next button.

The plugin will then perform some scans. If everything appears to be in order, click the Build button.

Duplicator will now generate a package for you to download, along with the installer script. Don’t hesitate to save both files to your computer.

Read Also  How to Choose the Best Hosting Platform for your Blog in 2023

Step 2: For a new WordPress installation, create a new database.

Although you can use the existing WordPress database, it is preferable to create a new one so that your old database remains safe and intact. In this way, if something goes wrong, you can quickly return to your site.

Go to the cPanel dashboard for your hosting account, scroll down to the ‘Databases’ section, and then click the ‘MySQL Databases’ icon.

After that, just give your database a name and click the ‘Create Database’ button.

For you, Cpanel will now create a new database. Afterwards, go to the ‘MySQL Users’ section then, scroll down.

To create a new database user, enter a username and password and then click the ‘Create a user’ button.

You must now grant the new user database permissions.

Scroll down to the section titled “Add User to Database.” Simply choose the database user you created from the dropdown menu next to the ‘User’ field, then select the database from the dropdown menu, and click the add button.

Your new database is now ready to be used with your freshly installed WordPress.

3. Launch the Duplicator Wizard.

Now you must upload the Duplicator archive package and the installer file you previously downloaded to your website’s root directory.

The /wordpress/ folder will be located in this directory.

Open the installer script in a browser window after you’ve uploaded both files. You’ll need to start with your site’s root URL and then add /installer.php to the end.

https://example.com/installer.php

The Duplicator installer wizard will open as a result of this.

To proceed, check the terms and conditions box and then click the ‘Next’ button.

It will then request database information from you. Fill in the details for the database we created in step 2.

To proceed, click the next button after entering database information.

Duplicator will then unpack your archived WordPress database backup into your new database.

It will then prompt you to update the site’s URL and Path. You don’t need to do anything because the new URL and path will be detected automatically. If it doesn’t, you’ll have to manually enter it here.

Read Also  How to Easily Manage Multiple WordPress Sites from One Dashboard

Duplicator will now complete the migration, and you will be able to access your website at its new location by clicking the Admin login button.

Step 4: Configure Root Folder to Subdirectory Redirects

Congratulations, your WordPress site has been moved from a subdirectory to the root folder.

It’s now time to set up redirects so that your users and search engines can find the new location of your website.

To begin, use an FTP client to connect to your WordPress site, then delete the old /wordpress/ folder.

Switch to your WordPress site’s admin area after that. Your WordPress admin URL will look like this now that you’ve moved it to the root of your website:

https://example.com/wp-admin

The Redirection plugin must now be installed and activated. See our step-by-step guide to installing a WordPress plugin for more information.

You must go to the Tools » Redirection page after activation. A setup wizard will now appear in the plugin. Simply click the continue setup and then the finish setup buttons to complete the process.

After that, go to the ‘Redirects’ tab and create your new redirect.

To begin, select the ‘Regex’ checkbox in the first field’s corner.

After that, add https://example.com/wordpress/.* to the source URL and https://example.com/$1 to the target URL.

Remember to substitute your own domain name for example.com. Save your changes, select the ‘Add Redirect’ button.

All users who visit your website using the /wordpress/ URL will now be automatically redirected to the correct posts using your new root URL.

That is all there is to it. We hope that this article has shown you how to remove the /wordpress/ prefix from your WordPress site URL.

If you liked this post, please find and follow us on InstagramTwitter and Facebook.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome & exclusive content in your inbox, every week.

We don’t spam! Read our privacy policy for more info.

Your Blog Master
Your Blog Masterhttp://yourblogmaster.com
Your Blog Master is more than just a blog; it’s a community of like-minded individuals passionate about technology. Join us in discussions, share your insights, and learn from others.

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

We don’t spam! Read our privacy policy for more info.

Latest stories