It’s an easy mistake to make, a simple problem to overlook and an evil solution to find. Usually, when a person changes the location of their WordPress folder on their host, they find themselvers literally locked out of their WordPress, unable to log in to it. This is because they most likely forgot to change their Site’s URL to the new location, causing the WordPress login function to search for the login page where it doesn’t exist. If this has happened to you, will happen to you, or is happening to your right now, fear not! Follow this tutorial, and you’ll be on your merry way in a few minutes.

Proof That Directory Has Changed

Here is some “proof” that I have changed the location/name of my testing directory from www.enchantmenot.org/testing to www.enchantmenot.org/layout-testing. A small change, yes, but still deadly. (Please note, I have changed it back to enchantmenot.org/testing). As you can see in the screenshot below, the testing directory loads my WordPress theme:

As you can see, I changed the testing directory to layout_testing

After this change, enchantmenot.org/testing no longer showed my layout, however enchantmenot.org/layout_testing did – this is what I wanted.

However, this is where the problems start. When I go to enchantmenot.org/layout_testing/wp-admin to log in to my WordPress dashboard, it redirects me to the wp-login.php

Step 1: Get into phpMyAdmin

In order to solve this problem, you will need to log in to your cPanel account, and locate the phpMyAdmin option, found in the Dashboard tab.

Step 2: Locate WordPress Database

Hopefully you only have one WordPress database in your phpMyAdmin, however I know many people have more than one. Figure out which database is linked to the WordPress directory you need, in this case it’s the _wpTesting database. Click on it, and it loads a new page with a list of Tables in the Database.

Step 3: Locate Site URL Field

Here, locate the wp_options table, and click on the browse icon – the first icon beside the name of the table.

This will load a new page with a list of fields from the table.

Locate the siteurl field – it should be the first one.

Step 4: Edit The Site URL

Click on the pencil or edit tool, and it will bring you to an editable form.

Change the URL in the large field from the old directory location to the new location – in my case I’m changing it from http://enchantmenot.org/testing to http://enchantmenot.org/layout_testing.

Then hit Go at the bottom of the page. The wp_options table will reload now, with a few changes. At the top, you should see a message stating that the change was successful. You will get this message: “1 row(s) affected”.

Step 4: Login To Your Dashboard

Test out the change to make sure it works. If we go back to www.enchantmenot.org/layout_testing/wp-admin, the page should load the WordPress’s Admin login page, as shown below.

Assuming everything went well, you can login using your normal login details, and voila! You will be inside your WordPress Dashboard.

If you have any questions, feel free to leave them below! I hope this tutorial helped you sort out any problems you had with your site.