When you’re venturing into building your own website with WordPress, there are bound to be a few bumps along the way.
The first step to creating your WordPress powered site is by uploading the software to your server. Many web hosting providers make it easy to download the WordPress to a site directly using a Quick Install option, however, even this can be done incorrectly.
This is usually not what most intend or want for their website — not to mention, it really doesn’t look all that professional. If this URL accident has happened to you, then you’ll be happy to know that there is a way to fix this without hiring someone else who will charge an arm and a leg.
If you are still confused about the whole issue, please see our post on how to determine the WordPress login URL.
If this URL accident has happened to you, then you’ll be happy to know that there is a way to fix this without hiring someone else who will charge an arm and a leg.
For Fresh WordPress Installations
So first off, if you’ve just installed WordPress and it’s all shiny and new on your site, but you’ve found that you accidentally installed it in a subdirectory, then you’re better off than most.
Assuming that your site is simply a fresh WP install and there is no content that is worth saving, then you will need to go back to your cPanel to uninstall WordPress and re-install it under your root directory.
If you’ve caught this URL issue too late and you have content on your site that needs to be saved, then you’ll have to go the longer route in order to get things straight.
Making URLs as short as possible is, in fact, one of many ways you can do SEO on your WooCommerce store or blog. You want to be careful with it though. Especially true if you are running a big blog or a WooCommerce store and don’t want to lose your rankings after the URL change.
Don’t worry though, we have made the procedure easy to follow even if you are new to all this.
For A WordPress Site With Content
If you don’t fall into the category above, then this is the course of action you’ll have to take in order to change your URL and get rid of the /wordpress/ part of your site address. Although we have already posted a guide on how to customize the WordPress login URL for your blog, the below steps will also do.
1- Login To Your WP Dashboard and Change Your Site Address
Login to your Admin WordPress Dashboard and navigate over to Settings → General. Here is where you will find to URL options.
- WordPress Address (URL)
- Site Address (URL)
Right now, they should be the exact same address; they both have /wordpress/ as part of the URL.
Get started by deleting the /wordpress/ part of the URL from the Site Address option (do not remove it from the WordPress Address).
This means that your Site Address URL should like this:
Go down to the bottom of the screen and save your changes. When you go to your site, you will now see an error message telling you that your website doesn’t exist or something like that — don’t panic this is normal.
Although, if you a really scared, do take the WordPress backup of your website. You can then make the above or the other necessary changes easily without worrying about your website.
2- Use An FTP Client To Connect To Your Site
This is where things can get a little bit technical, but we’ll do our best to break it down so that it is easy for you to follow.
Once you’ve downloaded and installed FileZilla, you will need to enter some information to pull up the files that you are going to be moving from the subdirectory to the root directory.
- Host | Enter your site’s URL here. If that doesn’t work, contact your web host for this information.
- Username | Put your cPanel Admin Username here. If someone else is managing your server, ask them for your FTP username.
- Password | Enter the password for your cPanel Admin or FTP user here.
After you’ve done that, you will click the Quick Connect button. Now that you’re connected you should see the /wordpress/ directory show up in the list that has rendered — click on it.
There will be a list of files show up now. You want to now download the following files to your computer:
- .htaccess (note: if you can’t find this file, that it because it is hidden from view. Look for the server menu tab in FileZilla and select the option that forces hidden files to appear. Also, if you are using Pretty Permalinks, you may not even have a .htaccess file so in that case — just download the index.php file.)
As a word of caution: don’t delete the files in the subdirectory. Just copy them to your computer or you’re going to create a serious issue for yourself.
3- Open and Edit The Index.php File
For this next part, you’ll need to open the Index.php file in the text editor of your choice. Take your time to search through the code and find the following line of code:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
Delete this file and replace it with this line of code and save it:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
4- Upload To Root Directory and Login To Your Site
Take your newly edited Index.php file and the .htaccess file and upload them to the root directory using your FTP client. You should now have your URL in the correct format.
In case you need to access your WordPress Admin panel, you will still need to login using your original login URL (i.e. www.yoursiteurl.com/wordpress/wp-admin).
You can now setup WordPress Templates on your websites and start posting content.
Do tell us your views about the above tutorial in the comment section below.