Change upload directory after launch
3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 13, 2014 (RSS)
By clowden - February 13, 2014 - edited: February 13, 2014
After launching a rather large website for a client, they decided they would like to move their uploads outside of the /admin/uploads/ directory so their files can be indexed and not show the /admin/ directory in the path.
Not normally a problem, I duplicated the /admin/uploads/ directory and placed it in the root, /uploads/, and changed the paths in the General Settings to reflect the change. The problem is the images and files that have been uploaded through the WYSIWYG editor is still showing the /admin/uploads/ directory as it's path. Is there a way to change this dynamically or am I in for a lengthy treat of doing this manually?
Thank you for the help.
By Dave - February 13, 2014
Hi clowden,
Unfortunately, there's no easy way to do that.
But if you're comfortable with MySQL (or want to learn) you could try this:
- Backup the database first under: Admin > General
- Install the MySQL Console plugin: http://www.interactivetools.com/add-ons/detail.php?MySQL-Console-1011
- Try a query like this: UPDATE cms_articles SET content = REPLACE(content, "Search for this", "Replace with This")
Here's an article: http://stackoverflow.com/questions/4271186/how-can-i-use-mysql-replace-to-replace-strings-in-multiple-records
TIP: When doing raw MySQL queries, it's ALWAYS your best bet to assume you're going to mess everything up, and backup and test accordingly. It's very easy to do so. But as long as you have a backup you can always restore (through the CMSB Admin > General page).
Hope that helps!
interactivetools.com
By clowden - February 13, 2014
I figured this was going to be the answer, but was crossing my fingers for some kind of magical way. Thanks for the help Dave.