Change WordPress directory

  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.