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

When I downloaded and installed WordPress for the first time I did a mistake and installed WordPress in a subdirectory, which causes /wordpress/ or /wp/ to appear in the website URL like this https://mikalsenon.net/wp/ instead of https://mikalsenon.net/.

In this guide I will show the steps to follow to get rid of the /wordpress/ from your WordPress site’s URL.

Step 1:  Login to your WordPress site’s admin area and go to Settings » General page.

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

You need to change the Site Address option and point to your root domain, e.g. https://mikalsenon.net and leave WordPress Address option as it is.

Once you do that, click on Save Changes button to store your settings.

Step 2:  You need to connect to your website using an FTP client. Once you are connected, go to the /wordpress/ or /wp/ 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.

Step 3: 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:

1
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:

1
require( dirname( __FILE__ ) . '/wp/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/

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:

https://mikalsenon.net/wp/wp-admin

Avatar

Jonny Mikalsen

I am an enthusiastic amateur photographer with a big passion for photography who loves to take pictures. I’m always aiming to learn new photographic skills and would like to spend more time out in the field or on a photo shoot with my camera.

image/svg+xml

Menu

Follow me

Recent Blog Posts

Instagram Feed

Contact Information

Jonny Mikalsen
Steinsvikskrenten 53
5237 Rådal
Norway

+47 90576512
jonny.mikalsen[at]nullmikalsenon.net

Social

Capturing moments from today… Creating memories for a lifetime

— Jonny Mikalsen