Installing WordPress is very easy, but some users install on a subfolder instead of the main root http://www.example.com/. If you install it on a subfolder, your URL will be http://www.example.com/wordpress/. In this article we are going to explain how to remove /wordpress/ from WordPress URL.
If this has happened to you, don't worry. You just have to move your WordPress files to the main root. It takes a few steps, so keep reading.
Why my website URL includes /wordpress/?
When installing WordPress, you need to make sure to install it in the main folder of your site. Sometimes, we make mistakes and a WordPress subfolder may be created in the main folder, with everything installed in there. Consequently, /WordPress/ is shown in your URL. If you want to remove it, you should either reinstall your WordPress website or move your WordPress from the subfolder to the main folder.
If your website is new and you don’t have any content on it, we recommend reinstalling WordPress from the beginning and make sure you install it in the main folder. But, if you’re using your website and you have some content on it, you will have to make some changes to htaccess.php and index.php to fix this problem.
Removing /WordPress/ from your website’s URL
Before making any changes to your website, make sure you get back up for your website in case anything goes wrong and you lose all the information you had on your website.
If you’ve been running your WordPress website for some time and you have a lot of information on it, to remove /WordPress/ from your URL you should follow these steps. Although keep in mind that by doing so the URL of your pictures and images that you have uploaded on your website will be changed.
Go to your WordPress dashboard and from Settings go to General page.
You will see two fields related to your URL. Change both of them to your original domain name, for example, change http://www.example.com/wordpress/ to http://www.example.com.
Make sure you click on save once you’re done.
Head over to your hosting (server), locate and download htaccess. and index.php. we won’t be making any changes to htaccess but in the next step, we will have to upload it along with index.php, htaccess. Manages the way users access our website. This file should be in your main folder.
If you’re using FTP and cannot locate htaccess. It’s probably hidden and you have to look for it in the hidden files.
If you are using Filezilla, to show hidden files simply click on Server and select “Force Displaying Hidden Files”.
If you are using File Manager, to show hidden files simply click on Setting and tick “Show Hidden Files”.
After finding index.php and htaccess. download it on your PC. Then open index.php with NotePad or Notepad++ and find the code below:
require( dirname( __FILE__ ) . ‘/wp-blog-header.php' );
This code opens wp-blog-header.php, this code is necessary to load your website. The only change you need to make is to enter the right URL.
require( dirname( __FILE__ ) . ‘/wordpress/wp-blog-header.php' );
This code will tell the browser, the information it's looking for is in the WordPress/ subfolder and it will automatically redirect to it.
Make sure you save the changes you’ve done, and with the help of FTP upload these files to your website’s root. You should upload these to /public_html/
And our work ends here. Now you can upload your website from the main folder (root) and everything should work perfectly fine.
Keep in mind, these changes are done only for your visitors, to access your admin dashboard you will have to use the previous URL: http://www.examples.com/wordpress/wp-admin
Advantages of Removing /WordPress/ from your URL
In WordPress, by changing the main domain you delete any extra URL your website may have. When your website is installed on the wrong folder it will make your website’s URL longer, and it may cause some issues for your website’s audience. A professional website never makes such a mistake, if you want to display a professional and beautiful website, the first step would be to eliminate this issue.
Only removing /WordPress/ from your website’s URL is much easier than moving a website with a lot of information from one folder to another.
In this article, we discussed how to remove /wordpress/ from WordPress URL. This can be easily changed from the WordPress dashboard or by accessing your main files with an FTP client. However, before making any changes to your website, make sure to get a full backup of your entire site.