{"id":37316,"date":"2021-10-05T16:23:25","date_gmt":"2021-10-05T16:23:25","guid":{"rendered":"\/tutorials\/?p=37316"},"modified":"2024-02-01T08:12:07","modified_gmt":"2024-02-01T08:12:07","slug":"how-to-move-wordpress-from-a-subfolder-to-the-root-directory","status":"publish","type":"post","link":"\/uk\/tutorials\/how-to-move-wordpress-from-a-subfolder-to-the-root-directory","title":{"rendered":"How to Move WordPress from a Subfolder to Root Directory: Safe Methods to Move Your Site"},"content":{"rendered":"<p>Creating a website in a subfolder such as <strong>www.example.com\/subdirectory<\/strong> instead of the root folder of<strong> www.example.com <\/strong>is useful for several purposes.<\/p><p>For example, you can create a staging site to replace a static site in a subfolder while the existing site is still functioning in the root folder. Or, you can install WordPress without filling up your root folder with additional files.<\/p><p>However, as your site grows, you may want to move the site to the root directory. This involves moving website files from the subfolder up one level, which can be a technical and risky process if you don&rsquo;t do it correctly.<\/p><p>Thus, this article will provide you with a step-by-step guide to move WordPress from a subfolder to the root directory safely.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download all in one WordPress cheat sheet<\/a><\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-before-moving-your-wordpress-site\">Before Moving Your WordPress Site<\/h2><p>First and foremost, you need to have access to the web host control panel as you&rsquo;ll move and make changes to the WordPress core files using it. Alternatively, you&rsquo;ll need to install a <a href=\"\/uk\/tutorials\/what-is-ftp\">File Transfer Protocol<\/a> (FTP) client such as <a href=\"http:\/\/filezilla-project.org\/\" target=\"_blank\" rel=\"noopener\">FileZilla<\/a> on your computer.<\/p><p>The next important step is to <a href=\"\/uk\/tutorials\/backup-wordpress\">backup your WordPress<\/a> website and database. You should have a backup of the most recent version of your site so if something goes wrong when moving the website, you can resolve the issue easily and prevent loss of data.<\/p><p>Lastly, ensure that the root directory is clear of other or old site files such as <strong>index.php<\/strong>. They are not related to your WordPress site and will interfere with it.<\/p><p>If there are some old website files, download them for safekeeping or copy and paste them to a separate folder such as <strong>old_site_backup<\/strong>.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/uk\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-moving-your-wordpress-site-to-the-root-directory\">Moving Your WordPress Site to the Root Directory<\/h2><p>There are two methods for <a href=\"\/uk\/tutorials\/how-to-migrate-wordpress\">WordPress migration<\/a> to the root folder &ndash; using the file manager of your hosting provider or an FTP client. Since it&rsquo;s going to be a major update to your site, consider <a href=\"\/uk\/tutorials\/unpublish-wordpress-site\">unpublishing your WordPress site<\/a> during the process to maintain a smooth user experience. <\/p><h3 class=\"wp-block-heading\" id=\"h-moving-wordpress-from-subfolder-to-root-directory-with-hpanel\">Moving WordPress From Subfolder to Root Directory With hPanel<\/h3><p>The first method involves <a href=\"\/uk\/tutorials\/how-to-use-hostinger-file-manager\/\">using the web host&rsquo;s file manager<\/a>. We will show you how to do that on hPanel, but the process is similar to moving a website using the cPanel file manager.<\/p><ol class=\"wp-block-list\">\n<li>Log in to your hPanel and find <strong>File Manager<\/strong> in the <strong>Files <\/strong>section.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"655\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted-1024x655.png\" alt=\"File Manager on hPanel\" class=\"wp-image-79439\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted-1024x655.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted-300x192.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted-150x96.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted-768x491.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanagerhighlighted.png 1162w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>Go to the<strong> public_html<\/strong> folder.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml.png\"><img decoding=\"async\" width=\"1024\" height=\"212\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml-1024x212.png\" alt=\"public_html directory on file manager\" class=\"wp-image-79464\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml-1024x212.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml-300x62.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml-150x31.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml-768x159.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/hpanel-hosting-dashboard-filemanager-publichtml.png 1157w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>If there are existing WordPress files in the <strong>public_html<\/strong> folder, be sure to back them up first by copying and pasting them to a new folder.<\/li>\n\n\n\n<li>Go to the subfolder where your website is located. For example, if the website address is <strong>www.example.com\/subdirectory<\/strong>, there should be a <strong>subdirectory <\/strong>folder.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectoryhighlighted.png\"><img decoding=\"async\" width=\"842\" height=\"255\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectoryhighlighted.png\" alt=\"Subdirectory folder on file manager\" class=\"wp-image-79469\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectoryhighlighted.png 842w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectoryhighlighted-300x91.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectoryhighlighted-150x45.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectoryhighlighted-768x233.png 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"5\">\n<li>Press <strong>CTRL+A<\/strong> on Windows or <strong>Command+A<\/strong> on Mac to select all the folder content.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectory-selectallfiles.png\"><img decoding=\"async\" width=\"842\" height=\"256\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectory-selectallfiles.png\" alt=\"selecting all files on file manager\" class=\"wp-image-79487\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectory-selectallfiles.png 842w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectory-selectallfiles-300x91.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectory-selectallfiles-150x46.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-publichtml-subdirectory-selectallfiles-768x234.png 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"6\">\n<li>Click on the <strong>Move <\/strong>button on the top panel of the File Manager.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"285\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted-1024x285.png\" alt=\"The Move button on file manager\" class=\"wp-image-79494\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted-1024x285.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted-300x83.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted-150x42.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted-768x213.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movebuttonhighlighted.png 1144w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"7\">\n<li>Change the <strong>Destination <\/strong>directory to <strong>\/domains\/example.com\/public_html<\/strong> and then click <strong>Move<\/strong>. Remember to replace example.com with your actual domain name.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-movefilesmenu.png\"><img decoding=\"async\" width=\"395\" height=\"431\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-dashboard-filemanager-movefilesmenu.png\" alt=\"Setting up destination directory when moving files on file manager\" class=\"wp-image-79512\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movefilesmenu.png 395w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movefilesmenu-275x300.png 275w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-dashboard-filemanager-movefilesmenu-137x150.png 137w\" sizes=\"(max-width: 395px) 100vw, 395px\" \/><\/a><\/figure><\/div><p>Now, go back to <strong>public_html<\/strong> to see if all WordPress files and folders have been moved correctly.<\/p><h3 class=\"wp-block-heading\" id=\"h-moving-wordpress-from-subfolder-to-root-directory-with-ftp-client\">Moving WordPress From Subfolder to Root Directory With FTP Client<\/h3><p>The first step is to <a href=\"\/uk\/tutorials\/ftp\/filezilla-ftp-configuration\">connect an FTP client to your website<\/a> to move WordPress files. Here are the steps to do so with FileZilla:<\/p><ol class=\"wp-block-list\">\n<li>Log in to your hPanel and find <strong>FTP Accounts<\/strong> in the Files section.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-ftpaccounts-highlight.png\"><img decoding=\"async\" width=\"444\" height=\"578\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-ftpaccounts-highlight.png\" alt=\"FTP Accounnts menu on hPanel dashboard\" class=\"wp-image-79408\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-highlight.png 444w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-highlight-230x300.png 230w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-highlight-115x150.png 115w\" sizes=\"(max-width: 444px) 100vw, 444px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>You will find the FTP access details such as <strong>FTP IP<\/strong>, <strong>hostname<\/strong>, and <strong>username<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-ftpaccounts.png\"><img decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-ftpaccounts-1024x684.png\" alt=\"FTP Accounts details\" class=\"wp-image-79410\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-1024x684.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-300x201.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-150x100.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts-768x513.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-files-ftpaccounts.png 1125w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>If you don&rsquo;t know the FTP password, click<strong> Change account password<\/strong>. It lets you reset the password without having to know the current one.<\/li>\n\n\n\n<li>Open FileZilla.<\/li>\n\n\n\n<li>Click the <strong>File<\/strong> menu at the top of the window and select <strong>Site Manager<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-site-manager.png\"><img decoding=\"async\" width=\"352\" height=\"258\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-site-manager.png\" alt=\"Site Manager on FileZilla\" class=\"wp-image-37325\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-manager.png 352w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-manager-300x220.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-manager-150x110.png 150w\" sizes=\"(max-width: 352px) 100vw, 352px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"6\">\n<li>Enter the credentials according to the FTP access details on hPanel, then click <strong>Connect<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-site-manager-connect.png\"><img decoding=\"async\" width=\"444\" height=\"441\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-site-manager-connect.png\" alt=\"Configuring Site Manager on FileZilla\" class=\"wp-image-37326\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-manager-connect.png 444w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-manager-connect-300x298.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-manager-connect-150x150.png 150w\" sizes=\"(max-width: 444px) 100vw, 444px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"7\">\n<li>Once FileZilla successfully connects to your website, the website directory will appear on the <strong>Remote site<\/strong> section, and the website files will appear below it.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-remote-site.png\"><img decoding=\"async\" width=\"926\" height=\"648\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-remote-site.png\" alt=\"Remote site section on FileZilla\" class=\"wp-image-37327\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-remote-site.png 926w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-remote-site-300x210.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-remote-site-150x105.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-remote-site-768x537.png 768w\" sizes=\"(max-width: 926px) 100vw, 926px\" \/><\/a><\/figure><\/div><p>Now let&rsquo;s move the website files from the subfolder to the root directory.<\/p><ol class=\"wp-block-list\">\n<li>Open the subfolder where your WordPress website is located. The common directory is <strong>domains <\/strong>-&gt;<strong> example.com <\/strong>-&gt;<strong> public_html <\/strong>-&gt;<strong> subdirectory<\/strong>. Just as in the previous method, be sure to back up any existing website files in the root directory.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-site-directory.png\"><img decoding=\"async\" width=\"464\" height=\"310\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-site-directory.png\" alt=\"Website directory on FileZilla\" class=\"wp-image-37328\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-directory.png 464w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-directory-300x200.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-site-directory-150x100.png 150w\" sizes=\"(max-width: 464px) 100vw, 464px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>Select all files, and drag and drop them to the <strong>public_html<\/strong> folder on the <strong>Remote site<\/strong> section.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-select-files.png\"><img decoding=\"async\" width=\"462\" height=\"311\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-select-files.png\" alt=\"Opening public_html directory on FileZilla\" class=\"wp-image-37329\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-select-files.png 462w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-select-files-300x202.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-select-files-150x101.png 150w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/a><\/figure><\/div><p>The process of moving the WordPress core files and folders may take time. Keep an eye on the status box at the top to see if the file transfer was successful.<\/p><h2 class=\"wp-block-heading\" id=\"h-change-your-wordpress-site-url\">Change Your WordPress Site URL<\/h2><p>The next step is to change the site&rsquo;s URL settings in the <strong><a href=\"\/uk\/tutorials\/wp-config-php\">wp-config.php<\/a><\/strong> file so you can access <strong>wp-admin<\/strong> from the root domain.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-wp-config.png\"><img decoding=\"async\" width=\"1024\" height=\"646\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-wp-config-1024x646.png\" alt=\"The wp-config.php file on file manager\" class=\"wp-image-79511\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/filemanager-wp-config.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/filemanager-wp-config-300x189.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/filemanager-wp-config-150x95.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/filemanager-wp-config-768x485.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Open <strong>wp-config.php<\/strong> from your website directory and insert the following lines before <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">\/*<\/code> <\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">That's all, stop editing! Happy publishing. *\/ :\ndefine(&lsquo;WP_HOME&rsquo;,&rsquo;http:\/\/example.com&rsquo;);\ndefine(&lsquo;WP_SITEURL&rsquo;,&rsquo;http:\/\/example.com&rsquo;);<\/pre><p>Replace <strong>example.com<\/strong> with your actual domain name, then save and close the file.<\/p><h2 class=\"wp-block-heading\" id=\"h-update-your-urls\">Update Your URLs<\/h2><p>After moving the WordPress website to the new directory, the permalinks may not work. Here&rsquo;s how to <a href=\"\/uk\/tutorials\/wordpress-broken-permalinks\">fix broken permalinks<\/a> via the WordPress dashboard:<\/p><ol class=\"wp-block-list\">\n<li>Log in to your WordPress admin dashboard and navigate to <strong>Settings <\/strong>-&gt;<strong> Permalinks<\/strong>.<\/li>\n\n\n\n<li>Select another permalinks structure option. For example, switch from <strong>Post name <\/strong>structure to <strong>Plain<\/strong>. Then, click <strong>Save changes<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-permalink-settings.png\"><img decoding=\"async\" width=\"1245\" height=\"854\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-permalink-settings.png\" alt=\"Permalink settings on WordPress dashboard\" class=\"wp-image-37331\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-permalink-settings.png 1245w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-permalink-settings-300x206.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-permalink-settings-1024x702.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-permalink-settings-150x103.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-permalink-settings-768x527.png 768w\" sizes=\"(max-width: 1245px) 100vw, 1245px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>Revert the setting to the previous option, for example, from <strong>Plain <\/strong>back to <strong>Post name <\/strong>structure. Click <strong>Save changes <\/strong>again.<\/li>\n<\/ol><p>Now, you have to update URLs on menu items and links on your website as they may still point to the old URL. Update them so that they point to the new domain address.<\/p><p>To avoid changing the URLs manually, <a href=\"\/uk\/tutorials\/wordpress\/how-to-install-wordpress-plugins\">install a WordPress plugin<\/a> such as <a href=\"https:\/\/wordpress.org\/plugins\/go-live-update-urls\/\" target=\"_blank\" rel=\"noopener\">Go Live Update URLs<\/a>. Once you&rsquo;ve got it installed and activated, follow these steps:<\/p><ol class=\"wp-block-list\">\n<li>Go to <strong>Tools <\/strong>-&gt;<strong> Go Live <\/strong>from your WordPress admin dashboard.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-go-live.png\"><img decoding=\"async\" width=\"322\" height=\"179\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-go-live.png\" alt=\"Go Live Update URLs plugin settings on WordPress\" class=\"wp-image-37332\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-go-live.png 322w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-go-live-300x167.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-go-live-150x83.png 150w\" sizes=\"(max-width: 322px) 100vw, 322px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"2\">\n<li>Check all the tables to update old URLs in the database.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-core-tables.png\"><img decoding=\"async\" width=\"820\" height=\"473\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-core-tables.png\" alt=\"Updating URLs on databases\" class=\"wp-image-37333\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-core-tables.png 820w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-core-tables-300x173.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-core-tables-150x87.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-core-tables-768x443.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"3\">\n<li>Enter your old and new URL in the <strong>Old URL <\/strong>and <strong>New URL <\/strong>fields.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-update-url.png\"><img decoding=\"async\" width=\"472\" height=\"208\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/wordpress-update-url.png\" alt=\"Changing URL on WordPress\" class=\"wp-image-37334\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-update-url.png 472w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-update-url-300x132.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/wordpress-update-url-150x66.png 150w\" sizes=\"(max-width: 472px) 100vw, 472px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"4\">\n<li>Click <strong>Update URLs<\/strong>.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-set-a-redirect-in-your-htaccess-file\">Set a Redirect in Your .htaccess File<\/h2><p>Even after you moved your WordPress site, some users may still use the old URL with the subdirectory. In this case, you have to set a redirect rule in your <strong>.htaccess<\/strong> file so that users who have the old URL will be automatically redirected to the new URL.<\/p><p>Doing this also prevents losing the results of your previous SEO efforts, as traffic to the old URL will be redirected to the new one.<\/p><p>Open the <strong>.htaccess<\/strong> file from your hPanel or FileZilla. The<strong> .htaccess<\/strong> file is located in the root directory and is often hidden. To show hidden files on FileZilla, navigate to <strong>Server <\/strong>on the top menu bar and select <strong>Force showing hidden files<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-force-show-hidden-files.png\"><img decoding=\"async\" width=\"514\" height=\"204\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/10\/ftp-client-force-show-hidden-files.png\" alt=\"Option for force showing hidden files on FileZilla\" class=\"wp-image-37335\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-force-show-hidden-files.png 514w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-force-show-hidden-files-300x119.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/10\/ftp-client-force-show-hidden-files-150x60.png 150w\" sizes=\"(max-width: 514px) 100vw, 514px\" \/><\/a><\/figure><\/div><p>Then, insert the following code in the file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RewriteEngine On\nRewriteCond %{HTTP_HOST} ^example.com\/subdirectory$ [OR]\nRewriteCond %{HTTP_HOST} ^www.example.com\/subdirectory$\nRewriteRule (.*)$ http:\/\/www.example.com\/$1 [R=301,L]<\/pre><p>Replace <strong>example.com<\/strong> and <strong>subdirectory <\/strong>with your domain and subdirectory name. If you don&rsquo;t use <strong>www <\/strong>in your URL, make sure to write it accordingly in the <strong>RewriteRule<\/strong> line.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Find Out Other Ways to Migrate to WordPress<\/h4>\n                    <p><br>\n<a href=\"\/uk\/tutorials\/wix-to-wordpress\/\">Wix to WordPress<\/a><br>\n<a href=\"\/uk\/tutorials\/how-to-migrate-from-squarespace-to-wordpress\">Squarespace to WordPress<\/a><br>\n<a href=\"\/uk\/tutorials\/how-to-convert-html-to-wordpress\">HTML to WordPress<\/a><br>\n<a href=\"\/uk\/tutorials\/how-to-migrate-from-blogger-to-wordpress\">Blogger to WordPress<\/a><br>\n<a href=\"\/uk\/tutorials\/how-to-migrate-from-joomla-to-wordpress\">Joomla to WordPress<\/a><\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Moving a WordPress site from a subfolder to the root directory involves moving all of its core files. While the process is simple, it&rsquo;s always best to create a backup of your data beforehand.<\/p><p>Once you are ready to move the website files, you need to choose whether to use the web host&rsquo;s file manager or an FTP client.<\/p><p>After moving the files, remember to change the WordPress site URL in the <strong>wp-config.php <\/strong>file to be able to access the WordPress admin panel from the root directory.<\/p><p>Also, pay attention when writing your URL, whether you are changing the WordPress URL or setting a redirect in the <strong>.htaccess<\/strong> file. If you use <strong>www<\/strong> in the URL, you should write it accordingly, such as <strong>www.example.com<\/strong>.<\/p><p>If you have any questions about this process, feel free to leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a website in a subfolder such as www.example.com\/subdirectory instead of the root folder of www.example.com is useful for several purposes. For example, you can create a staging site to replace a static site in a subfolder while the existing site is still functioning in the root folder. Or, you can install WordPress without filling [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/uk\/tutorials\/how-to-move-wordpress-from-a-subfolder-to-the-root-directory\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":172,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Move WordPress From a Subfolder to Root Directory","rank_math_description":"Struggling to move your WordPress website files from the subfolder to the root directory? This step-by-step guide is here to help you!","rank_math_focus_keyword":"move wordpress from subfolder to root","footnotes":""},"categories":[22635,22633],"tags":[],"class_list":["post-37316","post","type-post","status-publish","format-standard","hentry","category-website-management","category-wordpress"],"hreflangs":[],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/37316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/users\/172"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/comments?post=37316"}],"version-history":[{"count":26,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/37316\/revisions"}],"predecessor-version":[{"id":103269,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/37316\/revisions\/103269"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/media?parent=37316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/categories?post=37316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/tags?post=37316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}