• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Move Wordpress application from subfolder to root

Frater

Regular Pleskian
Wordpress is becoming more and more integrated with Plesk which makes it quite easy to setup a new domain for someone and install Wordpress so he can start.

Often this Wordpress site has to be developed and a better looking site is already available.

By default Wordpress installs in a subfolder /wordpress (I know you can change it by choosing "custom install"). After a while that website is ready for publishing.

To move that website I will have to move the running site to a subfolder and then move the content of /wordpress to the root. This is not sufficient. I then have to do a search and replace on the /wordpress and wordpress/ and replace it with /
No problem there....

But then I have lost Wordpress from the Plesk interface.....

What's the most elegant way to move a Plesk managed Wordpress site?
I don't mind if it stays in its folder (maybe preferrable?), as long as the user doesn't see that "/wordpress" in its URL.
 
I have the same question, but you could always change the site's root directory to the "/wordpress" subfolder?
 
In upcoming Plesk 12.1 version we have added possibility for installation first application to root directory. All other applications will be installed to corresponding directories for preventing possible conflicts between applications. Thus you can install WP first in root and then other applications if necessary.
In the current Plesk version you can select custom installation and remove directory for starting installation to the root directory.
 
Wordpress is becoming more and more integrated with Plesk which makes it quite easy to setup a new domain for someone and install Wordpress so he can start.

Often this Wordpress site has to be developed and a better looking site is already available.

By default Wordpress installs in a subfolder /wordpress (I know you can change it by choosing "custom install"). After a while that website is ready for publishing.

To move that website I will have to move the running site to a subfolder and then move the content of /wordpress to the root. This is not sufficient. I then have to do a search and replace on the /wordpress and wordpress/ and replace it with /
No problem there....

But then I have lost Wordpress from the Plesk interface.....

What's the most elegant way to move a Plesk managed Wordpress site?
I don't mind if it stays in its folder (maybe preferrable?), as long as the user doesn't see that "/wordpress" in its URL.

@Frater,

First of all, use the "custom installation" method, since that would prevent any "migration" issues concerning directories.

Second, the easiest way of moving WordPress installations safely, is the following:

1) install a (empty and clean) WordPress and specify the desired directory in the custom installation process,

2) go to the "old" WordPress domain or subdomain and

- select "Website Copying" (under tab "Websites & Domains"),
- select checkbox "Website in Plesk",
- choose appropriate "Site name",
- select "Keep existing files on the destination site",

3) open wp-config.php in the new WordPress installation and change the database settings to point to the existing database,

and this way, you have a safe way of moving all relevant files to a new directory, with a backup of the old WP site still remaining in the "old directory".

Note that you can also work-around step 2 and 3, by just migrating the full database to the new WordPress installation, with the additional advantage that the old WP Dbase can be kept as a backup (and that can do no harm).

Migrating the WordPress database is as easy as installing certain WP plugins, such as Migrate DB Pro.

Naturally, manual SQL export and import is also possible.

In short, steps 1 to 3 are more easy, if you do not want to buy a rock-solid database migration tool or plugin.

Finally, note that each domain or subdomain is and/or can be assigned its own directory, making step 1 to 3 rather obsolete.

However, an elegant AND SAFE way to move WordPress, without having conflicting config files and/or lost data, can be obtained by following steps 1 to 3 (and even though more effective methods exist, this method is rather dummyproof and comprehensive).

Kind regards.....
 
Since I just finished wrestling with this myself, and this forum came up in my Google searches, I'm sharing my solution.

Note, this is on a Linux server.

As an admin user, at a terminal:

plesk db dump > PSA.sql
This creates a SQL dump, essentially a backup of your psa database.

Edit that (or a copy of it) looking for instances of "/wordpress" and "'wordpress'" in the following tables:

  • apsResourcesParameters
  • WordpressInstanceProperties
  • WordpressInstances
Remove the relevant parts, for instance:

(145,71,'urlPrefix','wordpress') becomes (145,71,'urlPrefix','')

(14,16,'/httpdocs/wordpress',0,14) becomes (14,16,'/httpdocs',0,14)
Pay special attention to string lengths in variables that look like this:
... s:19:\"/httpdocs/wordpress\" ...
so that your updated string would be:
... s:9:\"/httpdocs\" ...


Once your SQL file is duly scrubbed, import it back into the psa database thus:

plesk db < PSA.sql

To be satisfied that your update has worked, show one of the updated tables:

plesk db show apsResourcesParameters
The lines with "urlPrefix" should no longer contain "wordpress".


Log into Plesk, and go to Server Management -> Wordpress.

Click on a broken installation, to edit it. Click the "Refresh" button at the top of that page. The page should now show a proper Wordpress installation in the root instead of a sub-folder.

Share and enjoy!


 
@option8,

That is not a practical solution.

One can or should make use of phpmyadmin to alter simple myqsl field entries, instead of creating a database dump, changing it and importing it again.

Furthermore, this also applies to changing directories for the WordPress installation: one does not have to change databases, but one might encounter issues with the (root) URL, which issues can be easily resolved by using phpmyadmin and a proper change of the field entries with option_id 1 (siteUrl) and option_id 2 (home) in the options table.

Kind regards....
 
Back
Top