window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/wpbrilliance.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=5.2.3"}}; !function(a,b,c){function d(a,b){var c=String.fromCharCode;l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,a),0,0);var d=k.toDataURL();l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,b),0,0);var e=k.toDataURL();return d===e}function e(a){var b;if(!l||!l.fillText)return!1;switch(l.textBaseline="top",l.font="600 32px Arial",a){case"flag":return!(b=d([55356,56826,55356,56819],[55356,56826,8203,55356,56819]))&&(b=d([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]),!b);case"emoji":return b=d([55357,56424,55356,57342,8205,55358,56605,8205,55357,56424,55356,57340],[55357,56424,55356,57342,8203,55358,56605,8203,55357,56424,55356,57340]),!b}return!1}function f(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var g,h,i,j,k=b.createElement("canvas"),l=k.getContext&&k.getContext("2d");for(j=Array("flag","emoji"),c.supports={everything:!0,everythingExceptFlag:!0},i=0;i
Mar 18, 2019
24 Views
0

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

Written by

Are you trying to remove /wordpress/ from your website’s URL? Sometimes beginners end up installing WordPress in a subdirectory, which causes /wordpress/ to appear in their website URL. If you accidentally installed WordPress in a subdirectory and 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 WordPress site’s URL. Note: The method shown in this tutorial works for other subdirectories as well. Why You See /wordpress/ in Your WordPress Site URL WordPress is quite easy to install and nowadays most WordPress hosting companies…

Are you trying to remove /wordpress/ from your website’s URL? Sometimes beginners end up installing WordPress in a subdirectory, which causes /wordpress/ to appear in their website URL.

If you accidentally installed WordPress in a subdirectory and 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 WordPress site’s URL.

Removing /wordpress/ from your WordPress site url

Note: The method shown in this tutorial works for other subdirectories as well.

Why You See /wordpress/ in Your WordPress Site URL

WordPress is quite easy to install and nowadays most WordPress hosting companies offer quick WordPress installers in thier hosting control panel.

However, some beginners who are manually installing WordPress may end up accidentally installing it in a subdirectory. Most often this subdirectory is named wordpress.

This happens primarily because users end up uploading the wordpress folder they find inside the official WordPress.org download.

Let’s take a look at how to easily fix this and get rid of /wordpress/ from your site’s URL.

Removing /wordpress/ from WordPress Site URL

If you have just installed WordPress and there is no content on your website, then you can just go ahead and start over.

Simply delete the current installation, and follow the instructions in our WordPress installation tutorial to properly reinstall WordPress.

If you have already added content to your website, then there are two easy ways to remove the /wordpress/ from your site’s URL.

Method 1: Change WordPress Site Address

If you have an established WordPress site, then this method is easier and quicker. The downside of this method is that your media files such as images will still use /wordpress/ in the URL.

First, you need to login to your WordPress site’s admin area and go to Settings » General page.

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

You need to change the Site Address option and 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.

Change WordPress site address

Next, you need to connect to your website using an FTP client. Once you are connected, go to the /wordpress/ directory and download the .htaccess and index.php files to your computer.

If you are unable to locate the .htaccess file, then you may need to force your FTP client to show hidden files. If you are using Filezilla, then you need to click on Server from the menu bar and select ‘Force Showing Hidden Files’ option.

Show hidden files in your FTP client

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 the wp-blog-header.php file which is required to load 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 index.php and .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/

Root directory with a separate WordPress folder inside it

That’s all. You can now visit your website using the root 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:

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

Method 2: Move WordPress to Root Directory

This method is more comprehensive and will permanently move your WordPress site from the subdirectory to the root folder of your website.

Step 1. Create a Duplicator Package

First, you need to install and activate the Duplicator plugin on your website. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Duplicator » Settings page and click on the ‘Create New’ button.

Create new duplicator package

This will launch the Duplicator wizard, which will create an installer package of your complete website. Click on the next button to continue.

Next, the plugin will run some scans. If everything looks OK, then you can click on the Build button.

Build duplicator package

Duplicator will now create a package and prompt you to download it along with the installer script. Go ahead and download both files to your computer.

Download duplicator package

Step 2. Create a New Database for a Fresh WordPress Install

You can use the existing WordPress database, but it is better to create a new one so that your old database is safe and unchanged. This way you could revert back to your site without much fuss if something goes wrong.

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

Database cPanel

After that simply provide a name for your database and click on the ‘Create Database’ button.

Create database

Cpanel will now create a new database for you. After that, you need to scroll down to the ‘MySQL Users’ section.

From here you need to provide a username and password for your new database user and click on the ‘Create a user’ button.

Create MySQL user

Now you need to assign database permissions to the new user.

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

Add user to database

Your new database is now ready to be used for the fresh WordPress installation.

Step 3. Run the Duplicator Wizard

Now, you need to upload the Duplicator archive package and the installer file you downloaded earlier to the root directory of your website.

This will be the directory containing the /wordpress/ folder.

Upload Duplicator files to the root folder of your website

After you have uploaded both files, open the installer script in a browser window. You will need to enter your site’s root URL and then prefix it with /installer.php.

https://example.com/installer.php

This will open the Duplicator installer wizard.

Duplicator wizard

Check the terms and conditions box and then click on the ‘Next’ button to continue.

Next, it will ask you to provide the database information. Enter the information for the database we created earlier in step 2.

Connect your database

After entering database information, click on the next button to continue.

Duplicator will now unpack your WordPress database backup from the archive into your new database.

Next, it will ask you to update the site URL and Path. You don’t need to do anything here as it will automatically detect new URL and path. However, if it doesn’t, then you can manually enter it here.

New site settings

Duplicator will now finish the migration, and you will be able to click on the Admin login button to access your website on the new location.

Migration finished

Step 4. Set up Subdirectory to Root Folder Redirects

Congrats, you have moved your WordPress site from subdirectory to the root folder.

Now it is time to setup redirects, so that your users and search engines can find your website’s new location.

First, you need to connect to your WordPress site using an FTP client and then delete the old /wordpress/ folder.

Delete old wordpress subdirectory

After that, switch to the admin area of your WordPress site. Since you have moved it to the root of your website your WordPress admin URL will be like this:

https://example.com/wp-admin

Now, you need to install and activate the Redirection plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Redirection page. The plugin will now show you a setup wizard. Simply click on the continue setup and then finish setup button.

Redirection setup

Next, you need to switch to the ‘Redirects’ tab and add your new redirect.

First check the ‘Regex’ checkbox at the corner of the first field.

After that, For source URL you will add https://example.com/wordpress/.* and for Target URL you will add https://example.com/$1.

Redirect subdirectory to root folder

Don’t forget to replace example.com with your own domain name. Click on the ‘Add Redirect’ button to save your changes.

From now on all users accessing your website with /wordpress/ in the URL will be automatically redirected to correct posts with your new root URL.

That’s all. We hope this article helped you learn how to get rid of /wordpress/ from your WordPress site URL. You may also want to see our comprehensive guide to most common WordPress errors and how to fix them.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Get Rid of /wordpress/ From your WordPress Site URL appeared first on WPBeginner.

Article Categories:
Tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc a odio nec justo rutrum faucibus.
$20
Buy Now