If you installed into a folder such as /wp and your site now loads at yourdomain.com/wp, here is how to move it to the root.
Steps
- Take a full backup.
- In WordPress go to Settings → General. Leave WordPress Address (URL) as
https://yourdomain.com/wpbut change Site Address (URL) tohttps://yourdomain.com. Save. The dashboard will still be reachable at /wp/wp-admin. - In cPanel File Manager, copy
index.phpand.htaccessfrom thewpfolder up intopublic_html. - Edit the copied
public_html/index.phpand change the last line fromrequire __DIR__ . '/wp-blog-header.php';torequire __DIR__ . '/wp/wp-blog-header.php'; - Visit yourdomain.com — the site should load at the root.
- Go to Settings → Permalinks and click Save to regenerate rewrite rules.
Alternative — move everything
If you would rather have no subfolder at all, select all files inside wp in File Manager, use Move to relocate them to public_html, then update both URL fields to the root domain and run a search-replace on the database for /wp in image paths.
Check that images in older posts still load afterwards; they often carry the old absolute path.