Kindly follow the below steps to move the wordpress installed directory to another directory:
For example if we need to move the wordpress installed directory to public_html i.e., https://domainname.com/wp to https://domainname.com/
? Login to the cPanel of the user
? Take a backup of the domain
? Move the entire files in public_html to a new folder, say “Main Site”
? Now copy the entire files inside wordpress directory to public_html
? Take the phpMyAdmin
? Select the user’s wordpress database->wp-options -> Change the site url and home url to https://domainname.com/ from https://domainname.com/wp
? Now edit the .htaccess as follows in public_html:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase / (/ represents public_html directory)
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] (Since index.php is located in public_html)
</IfModule>
# END WordPress
? If the images are not loading correctly in site, do the below steps:
? Take the phpMyAdmin -> Export the user’s database
? Create a copy of the downloaded SQL file and open in word, then find and replace the content “domainname/wp” to “domainname/”
? Take the phpMyAdmin and drop all the tables in user’s database and upload the edited SQL file
Now check the site.