Changing directory of a WordPress installation

Web hosting discussion, programming, and shared and dedicated servers.
3 posts Page 1 of 1
by LS-JS » Mon Oct 23, 2017 12:44 pm
I installed WordPress into a subdirectory of my account via Website/Domain Names > Website addons > Install WordPress. This went fine. After building a good part of the site there, I think I'd prefer to move the WP installation to my root directory. Failing that, I'd like to change the name of the directory in which I installed it.

I ftp'd into my site, changed the name of the directory, then changed the pointer to it in the WP admin. But that failed. Going to an URL for the site got me a 404 error.

Anyone have any suggestions as to how to make this work?
by davideo » Sun May 06, 2018 11:08 am
That's not how one changes directory. WP has a database in which the home URL is located. Here is the article I've consulted while trying to do the same thing. (Note: I managed to crash my site while doing this, so be careful.)

Hopefully, you can take care of what you need by changing Settings/general. The problem comes in if you need to edit the database. If you installed WP with one-click, you can't get access to the control that allows database editing. It's something of a Faustian bargain... I was told I would need to completely reinstall if I wanted that access. What a drag...

by joemuller » Thu May 10, 2018 1:27 pm
Full details on how to un-stick a moved install can be found here.

In short, assuming you don't have direct access * to the database, but you do have those bits correctly in your wp_config.php, you can do the following:

- In wp_login.php, find this line:

Code: Select all

require( dirname(__FILE__) . '/wp-load.php' );

- Insert these lines right below it: (change '' to your domain name and replace/remove the 'folder' bit if needed for something like a '/blog')

Code: Select all

update_option('siteurl', '' );
update_option('home', 'http://example.nett/folder' );

- Load up your site in a web browser and go to the new URL
- Edit wp_login.php again to remove those 2 temporary lines

Hope this is helpful!

-- Joe

* If you have Shell Access enabled on your account, you can use the 'mysql' command-line tool on to connect to the database and run queries that way - just use the credentials in the wp-config.php file.
I'm a proud employee of! :-)
3 posts Page 1 of 1

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 700 on Thu Jun 18, 2020 12:00 pm

Users browsing this forum: No registered users and 3 guests