Skip to content

Instantly share code, notes, and snippets.

@adnanhz
Created June 23, 2019 12:16
Show Gist options
  • Save adnanhz/9b456b9b22034f67062aa626ccdaae25 to your computer and use it in GitHub Desktop.
Save adnanhz/9b456b9b22034f67062aa626ccdaae25 to your computer and use it in GitHub Desktop.
Relocating Wordpress to a new folder on a server

How to move Wordpress to a new location on a server

  1. Assuming we want to move from /demo/foo/ to /demo/bar
  2. Copy /demo/foo/ to /demo/bar
  3. Make ESPECIALLY sure that the .htaccess file in foo has been copied to bar, because cp might not copy it in some cases.
  4. Open the .htaccess file and change RewriteBase to /demo/bar.
  5. Change the last RewriteRule to RewriteRule . /demo/bar/index.php [L]
  6. Save & exit htaccess.
  7. You should now get a 404 page when you open the website.
  8. Go to your database and open wp_options table, you will find 2 rows containing the website url, change them accordingly.
  9. You should be done here, but in case you get broken links, find a way to find all occurrences of the old URL in yiur database and replace them with the new URL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment