To move a WordPress site to a subdirectory on the same domain, follow these essential steps:
- Create the Subdirectory: On your server, create the desired subfolder (e.g., /blog) inside your existing web root.
- Move WordPress Files: Copy all WordPress files and folders from the current directory (typically the root) into the new subdirectory.
- Update Site URLs:
- Log in to your WordPress admin dashboard (Settings > General).
- Update both the WordPress Address (URL) and Site Address (URL) to include the new subdirectory path (e.g.,
https://yourdomain.com/blog
). - Alternatively, update the
siteurl
andhome
options directly in the database in the[prefix]_options
table.
- Fix Permalinks:
- Test and Clean Up:
Considerations:
- If internal links or images still point to the old path, you may need to update them (plugins like “Better Search Replace” can help).
- Always create a full backup of your files and database before starting this process.
- No changes to filesystem absolute paths are usually needed, as WordPress uses relative paths for content.
This process applies to moving a live site; steps may differ if you wish for the main domain to keep loading WordPress while the files reside in a subfolder (in that case, see WordPress documentation on [“Giving WordPress Its Own Directory”]).
If you want the site to run at the subdirectory URL, this method is correct. If you want to move from a subdomain, the procedure is very similar, but adjust your target paths accordingly.
Caveats:
- Some plugins or hard-coded links may require additional changes.
- Caching or CDN setups might require cache purge post-move.
- Always verify database updates, as incorrect URLs can lock you out of your admin area.
If a visual step-by-step is required, several guides and videos are available, but the steps above summarize the necessary process for manual migration within the same domai