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?
2 Answers
- Move your site files from site.com/website to site.com/wordpress (or just rename the folder if you prefer)
- Download the Search/Replace PHP script from here: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ and read the instructions carefully.
- Upload the Search/Replace PHP script to your new site location in a suitable folder eg. site.com/wordpress/srdb
- Run the script by visiting site.com/wordpress/srdb
- 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).
- Important: Delete the Search/Replace script from your server.
- Edit your site
.htaccess
file to change the lineRewriteBase /website
toRewriteBase /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.
- Move your folder from site.com/website to site.com/wordpress
- download your database (.sql format) from phpmyadmin.
- open .sql file with editor (sublime preferred) and find site.com/website and replace it to site.com/wordpress
- empty your database in the host.
- import modified / downloaded mysql database to phpmyadmin (.sql format)
- Enjoy!
-
What about serialized data in the database and the
.htaccess
file?– MatCommented May 11, 2018 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 Commented May 11, 2018 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...– MatCommented May 11, 2018 at 16:00 -
1You'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– MatCommented May 11, 2018 at 16:06
-
1No 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...– MatCommented May 11, 2018 at 16:41