Moving WordPress from a subdirectory to the domain root changes both its file location and public address. This guide covers a standard single-site installation where the WordPress files will also move to the root.
Prepare the move
- Back up the files and database.
- Confirm the domain’s actual document root in cPanel’s Domains screen.
- Check that the root does not contain another site you would overwrite.
- Record the current URLs and any
WP_HOMEorWP_SITEURLoverrides inwp-config.php. - Arrange a brief maintenance period and keep file/database access available if login becomes unavailable.
Multisite and installations that intentionally keep WordPress in a separate directory need their own migration procedure.
Change the address and move the files
- In WordPress, open Settings > General.
- Change WordPress Address (URL) and Site Address (URL) to the full root address, for example
https://example.com, where these fields control the installation. - Save the change. The old administration URL may stop working until the files move.
- Open Files > File Manager in cPanel.
- Enable Show Hidden Files (dotfiles).
- Open the source subdirectory and move the complete WordPress files and folders to the confirmed document root, preserving permissions.
- Resolve destination conflicts deliberately rather than overwriting unrelated files.
If configuration constants override the address fields, update those existing constants as part of the planned move instead of adding duplicate definitions.
Update stored links and rewrite rules
Open the new /wp-admin/ address. Use a serialisation-aware WordPress migration tool to update remaining old subdirectory URLs, testing its replacement first.
Open Settings > Permalinks and save the intended structure. Check .htaccess or the server’s equivalent rewrite rules and clear relevant caches.
A copied installation that still uses the same database is not an independent rollback site. Keep the verified backup, and do not delete the old directory until you have confirmed that required files and paths no longer depend on it.
Test the new address
Check pages, images, administrator login, forms and scheduled tasks. Add suitable redirects from old URLs without creating a loop or redirecting files still required at the old path.