Family Encyclopedia >> Electronics

How to get rid of /wordpress/ from your WordPress site URL

WordPress is very easy to install, however, sometimes beginners end up installing WordPress in a subdirectory instead of the root directory of their website, eg. instead of . If you accidentally installed WordPress in a subdirectory and now want to move it to the root directory, then you are in the right place. In this article, we'll show you how to get rid of /wordpress/ from your site's URL.

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

If you haven't uploaded any content to your site, you can remove your existing WordPress installation and start fresh by following our complete WordPress installation tutorial. However, if you already have your site up and running, read on.

You first need to login to the admin area of ​​your WordPress site and go to Settings »General . On the settings page, you will see WordPress Address and Site Address fields and both will have the same URL. You need to change the Site Address option to point to your root domain, eg and leave WordPress Address Option as is. Once you do that, click Save Changes button to store your settings.

Next, you need to connect to your website using an FTP client. Once you're connected, go to / wordpress / directory and download the .htaccess and index.php Files to the desktop on your computer.

You may not see. .htaccess in your /wordpress/ directory because it is a hidden file and your FTP client may not show it. To view the hidden file, you must enable the option to show hidden files in your FTP client. If you are using Filezilla, you need to click on Server in the menu bar and select 'Force Show Hidden Files' option.

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 wp-blog-header.php file, which is required to load the front-end of your WordPress site. What you need to do now is enter the correct file location by replacing the existing line with this:

 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 of it, usually named /www/ or /public_html/

That is all. You can now visit your website on your main domain, and everything will work just fine. However, if you need to log into your WordPress admin, you'll still need to go into wp-admin within the WordPress directory, like this:

We hope this tutorial helped you get rid of /wordpress/ from your site URL. For comments and questions leave a comment below.