I have a wordpress website in my server in let's say site.com/website. Now let's say i want to change the directory name and rename it to site.com/wordpress. How can I do that? I just change the folder name from File Manager?

  1. Move your site files from site.com/website to site.com/wordpress (or just rename the folder if you prefer)
  2. Download the Search/Replace PHP script from here: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ and read the instructions carefully.
  3. Upload the Search/Replace PHP script to your new site location in a suitable folder eg. site.com/wordpress/srdb
  4. Run the script by visiting site.com/wordpress/srdb
  5. Enter the existing site URL in the 'replace' field, and enter the new URL in the 'with' field, making sure there are no mistakes. Then run the search replace using the 'Live Run' button (you can also do a 'Dry Run' first to test).
  6. Important: Delete the Search/Replace script from your server.
  7. Edit your site .htaccess file to change the line RewriteBase /website to RewriteBase /wordpress

Job done!

Note: The reason for using the Search/Replace script above is because it's a lot faster than editing the SQL file manually and it doesn't require you to download the database or delete it. It's an automated process, so less chance of making mistakes when editing the database. And last but, by all means, not least it handles 'serialized' data in the database correctly.

| improve this answer | |
  1. Move your folder from site.com/website to site.com/wordpress
  2. download your database (.sql format) from phpmyadmin.
  3. open .sql file with editor (sublime preferred) and find site.com/website and replace it to site.com/wordpress
  4. empty your database in the host.
  5. import modified / downloaded mysql database to phpmyadmin (.sql format)
  6. Enjoy!
| improve this answer | |
  • What about serialized data in the database and the .htaccess file? – Mat May 11 '18 at 15:47
  • Once upload it may give you 500 internal server error because of .htaccess file. To fix this, login to dashboard and change permalink and it will work fine. I have not faced any serialized data issue till date while moving WP. If you find any error you can fix it with this plugin: wordpress.org/plugins/velvet-blues-update-urls – Milan Bastola May 11 '18 at 15:57
  • No, that wont work either and it wont give a 500 error, the site simply won't work - See my answer for what change will be required to the .htaccess file... – Mat May 11 '18 at 16:00
  • 1
    You've clearly not moved many WordPress websites then and don't have the professional experience to know how to do it correctly. No offence meant at all, but I'm saying this from experience. Here's some information on serialized data in WordPress: wpengine.co.uk/support/wordpress-serialized-data – Mat May 11 '18 at 16:06
  • 1
    No offence taken. But with all your experience on this subject you should know about serialized data stored in the WordPress database then shouldn't you? Also, just because you haven't faced a problem with this, it doesn't mean that a potential problem doesn't exist... – Mat May 11 '18 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.